我已经使用 Tensorflow hub 的 BERT 编码器有一段时间了。以下是语法:
tfhub_handle_encoder = "https://tfhub.dev/tensorflow/bert_multi_cased_L-12_H-768_A-12/4" tfhub_handle_preprocess = "https://tfhub.dev/tensorflow/bert_multi_cased_preprocess/3" bert_preprocess_model = hub.KerasLayer(tfhub_handle_preprocess)
突然我遇到了这个错误消息:
FileNotFoundError: Op type not registered 'CaseFoldUTF8' in binary running on acb9309ebd87. 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'.
相同的代码多年来一直运行良好。 Tf 版本 - 2.9,环境 - Colab/GCP Vertex AI
最佳答案
导入import tensorflow_text as text
应该可以解决这个问题。
编辑:您可能需要在 Colab 中运行 !pip install tensorflow_text
。
关于tensorflow2.0 - Tensorflow 2.X 错误 - 在 Colab 上运行的二进制文件中未注册 Op 类型 'CaseFoldUTF8',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75576980/