As the title is self-descriptive, I'm not able to import the BertTokenizer
and TFBertModel
classes from the transformers
package through the following code:
from transformers import BertTokenizer, TFBertModel
tokenizer = BertTokenizer.from_pretrained(BERT_PATH)
model = TFBertModel.from_pretrained(BERT_PATH)
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='tf')
resp = model(encoded_input)
print(resp)
As a result, I'm getting the following error:
RuntimeError: Failed to import transformers.models.bert.modeling_tf_bert because of the following error (look up to see its traceback):
dlopen(/Users/tk/miniforge3/envs/QA-benchmark/lib/python3.10/site-packages/tensorflow-plugins/libmetal_plugin.dylib, 0x0006): symbol not found in flat namespace '_TF_GetInputPropertiesList'
Here is my software stack:
OS: macOS Ventura 13.3.1
Python: 3.10
TensorFlow: macOS-tensorflow 2.9.0
Transformers: 4.28.0
BERT model: uncased_L-12_H-768_A-12
p.s. I've already posted this issue on the GitHub repository of transformers.