Using a BERT Model, I keep getting the error: Op type not registered 'CaseFoldUTF8' in binary running on MacBook-Pro-21.lan

56 views Asked by At

I am attempting to use a BERT model to help predict whether an update is urgent or not. I am able to tokenize the updates, with this output:

However, when I go to define the model, I keep getting CASEFOLDUTF8 errors. All packages are updated, I've attempted in Docker and google colab, optimally running an applemacbook m2 chip.

RuntimeError: Op type not registered 'CaseFoldUTF8' in binary running on MacBook-Pro-21.local. 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 (e.g. tf.contrib.resampler), accessing should be done before importing the graph, as contrib ops are lazily registered when the module is first accessed.

Updated tensorflow with same result. Restarted kernal, same result. Attempted in google colab, same result.

1

There are 1 answers

0
Jordan TheDodger On

I encountered a similar problem in Google Colab. This is a pip dependency error problem. Steps I followed to resolve:

!pip install --quiet tensorflow
!pip install --quiet tf-keras~=2.16
!pip install --quiet tensorflow_text

#after running above command in different cell
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
import random
import tensorflow as tf
import tf_keras as keras
import tensorflow_text
import tensorflow_hub as hub
print(tf.__version__) #o/p to latest tf version from Google colab

#code from TF.org for BERT text classification
# load pre-processing model and BERT
preprocess = hub.load('https://kaggle.com/models/tensorflow/bert/frameworks/TensorFlow2/variations/en-uncased-preprocess/versions/3')
bert = hub.load('https://www.kaggle.com/models/google/experts-bert/frameworks/TensorFlow2/variations/pubmed/versions/2') #will run with no error

Hope this helps! Thanks, Jordan