TENSORFLOW VERSION 2.11.0
When I try:
import tensorflow_hub as hub
preprocessor = hub.KerasLayer(“Google | universal-sentence-encoder | Kaggle”)
encoder = hub.KerasLayer(“Google | universal-sentence-encoder | Kaggle”)
I got the following warning:
WARNING:tensorflow:Please fix your imports. Module tensorflow.python.training.tracking.data_structures has been moved to tensorflow.python.trackable.data_structures. The old module will be deleted in version 2.11.
Traceback (most recent call last):
File “C:\Users\francesca\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py”, line 4199, in _get_op_def
return self._op_def_cache[type]
KeyError: ‘RegexSplitWithOffsets’
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “C:\Users\francesca\Anaconda3\lib\site-packages\tensorflow\python\saved_model\load.py”, line 958, in load_partial
loader = Loader(object_graph_proto, saved_model_proto, export_dir,
File “C:\Users\francesca\Anaconda3\lib\site-packages\tensorflow\python\saved_model\load.py”, line 154, in init
function_deserialization.load_function_def_library(
File “C:\Users\francesca\Anaconda3\lib\site-packages\tensorflow\python\saved_model\function_deserialization.py”, line 416, in load_function_def_library
func_graph = function_def_lib.function_def_to_graph(
File “C:\Users\francesca\Anaconda3\lib\site-packages\tensorflow\python\framework\function_def_to_graph.py”, line 82, in function_def_to_graph
graph_def, nested_to_flat_tensor_name = function_def_to_graph_def(
File “C:\Users\francesca\Anaconda3\lib\site-packages\tensorflow\python\framework\function_def_to_graph.py”, line 252, in function_def_to_graph_def
op_def = default_graph._get_op_def(node_def.op) # pylint: disable=protected-access
File “C:\Users\francesca\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py”, line 4203, in _get_op_def
pywrap_tf_session.TF_GraphGetOpDef(c_graph, compat.as_bytes(type),
tensorflow.python.framework.errors_impl.NotFoundError: Op type not registered ‘RegexSplitWithOffsets’ in binary running on PC-FRANCESCAW10. 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.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “D:\PYTHON\multiclass_txt_ipertensione_bert_no_translate.py”, line 234, in
preprocessor = hub.KerasLayer(“Google | universal-sentence-encoder | Kaggle”)
File “C:\Users\francesca\Anaconda3\lib\site-packages\tensorflow_hub\keras_layer.py”, line 153, in init
self._func = load_module(handle, tags, self._load_options)
File “C:\Users\francesca\Anaconda3\lib\site-packages\tensorflow_hub\keras_layer.py”, line 449, in load_module
return module_v2.load(handle, tags=tags, options=set_load_options)
File “C:\Users\francesca\Anaconda3\lib\site-packages\tensorflow_hub\module_v2.py”, line 106, in load
obj = tf.compat.v1.saved_model.load_v2(module_path, tags=tags)
File “C:\Users\francesca\Anaconda3\lib\site-packages\tensorflow\python\saved_model\load.py”, line 828, in load
result = load_partial(export_dir, None, tags, options)[“root”]
File “C:\Users\francesca\Anaconda3\lib\site-packages\tensorflow\python\saved_model\load.py”, line 961, in load_partial
raise FileNotFoundError(
FileNotFoundError: Op type not registered ‘RegexSplitWithOffsets’ in binary running on PC-FRANCESCAW10. 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’.
How can fix it?
Please help me