Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FileNotFoundError: Op type not registered 'RegexSplitWithOffsets' while loading Keras model

I am trying to load a Keras model on aws server with the following command

import tensorflow_hub as hub
from keras.models import load_model

model = load_model(model_path, custom_objects={'KerasLayer': hub.KerasLayer}) 

but its giving an error

FileNotFoundError: Op type not registered 'RegexSplitWithOffsets' in binary running on ip-10-0-xx-xxx.us-east-2.compute.internal. Make sure the Op and Kernel are registered in the binary running in this process. Note that if you are loading a saved graph which used ops from tf.contrib, accessing (e.g.) `tf.contrib.resampler` should be done before importing the graph, as contrib ops are lazily registered when the module is first accessed.
 You may be trying to load on a different device from the computational device. Consider setting the `experimental_io_device` option in `tf.saved_model.LoadOptions` to the io_device such as '/job:localhost'.

The exact same code was working the other day but this time it's giving an error. I double-checked if the model file is still there on the specified path. Also, the file is not modified so there is no doubt of the file being corrupt or anything.

I guess the error has to do something with aws, but I don't how to resolve it. I tried finding any solution on the web but it wasn't helpful.

like image 815
Darkstar Dream Avatar asked Nov 03 '25 03:11

Darkstar Dream


1 Answers

importing tensorflow_text resolve this issue

like image 155
Darkstar Dream Avatar answered Nov 04 '25 19:11

Darkstar Dream