Error while getting 'bert_en_uncased_preprocess' from hub
I referred to the Basic Usage example from this page: https://tfhub.dev/tensorflow/bert_en_uncased_L-24_H-1024_A-16/3
In this piece of code, I am getting the following error:
FileNotFoundError Traceback (most recent call last)
<ipython-input-6-0617e0c7bc87> in <module>()
5 trainable=True)
6 preprocessor = hub.KerasLayer(
----> 7 "https://tfhub.dev/tensorflow/bert_en_uncased_preprocess/1")
8 encoder_inputs = preprocessor(text_input)
9 outputs = encoder(encoder_inputs)
FileNotFoundError: Op type not registered 'CaseFoldUTF8' in binary running on c231cf5b24fe. 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.
If trying to load on a different device from the computational device, consider using setting the `experimental_io_device` option on tf.saved_model.LoadOptions to the io_device such as '/job:localhost'.
Any pointer to what I might be missing here?
You need to include the TF text ops by installing tensorflow-text.
!pip install tensorflow-text
See the model documentation for the preprocessing model at https://tfhub.dev/tensorflow/bert_en_uncased_preprocess/1
Thanks @kempy for the quick response. This worked for me. I'll close the issue.
Posting this for the benefit of anyone coming across this error. I ran into this error after trying to load a saved model on my machine. After installing it as a dependency, you need to include the import even though it's not used.
import tensorflow_text as text
Sample code:
#!/usr/bin/env python3
import tensorflow as tf
import tensorflow_text as text
def main():
new_model = tf.keras.models.load_model('../../model/bert-20')
new_model.summary()
if __name__ == '__main__':
main()
I experience a similar error. I have a TFX component that uses the BERT tokenizer and the BERT layer. When running it on a small sample on a virtual machine with a GPU attached, the component runs fine. However, when I run the Transformer job on Dataflow, I can see processing is happening, but it fails after some time with the same error message as the original poster.
FileNotFoundError: Op type not registered 'CaseFoldUTF8' in binary running on MSI. 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'.
i have the error.How to solve this
ERROR: Could not find a version that satisfies the requirement tensorflow-text (from versions: none) ERROR: No matching distribution found for tensorflow-text
Can someone tell why this error is showing when I am trying to install tf text
Hi, faced this error even after tensorflow_text was properly installed, and import tensorflow_hub as hub did not show any errors.
Fixed it by uninstalling tensorflow_hub using:
pip uninstall --user tensorflow_hub
Restarted the kernel, and now using tensorflow_hub does not yield errors. Hope this helps.