KeyError: 'NormalizeUTF8' loading a model to another jupyter notebook

Issue

I’m trying to reload another model to another jupyter notebook using this code:

import tensorflow as tf
reloaded = tf.saved_model.load('m_translator')
result = reloaded.tf_translate(input_text)

and I recently got this error:

KeyError                                  Traceback (most recent call last)
File ~\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\framework\ops.py:4177, in Graph._get_op_def(self, type)
   4176 try:
-> 4177   return self._op_def_cache[type]
   4178 except KeyError:

KeyError: 'NormalizeUTF8'
    FileNotFoundError: Op type not registered 'NormalizeUTF8' in binary running on LAPTOP-D3PPA576. 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'.

Solution

I had this issue before. To solve it, you need to install tensorflow_text. You should try to :

>>> tf.__version__
2.8.2
>>>!pip install tensorflow-text==2.8.2

Answered By – Clément Perroud

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published