我的env是由pycharm创建的,它有以下包: tensorflow==1.13.0rc1,CUDA = 11和相应的cudn.but从1到269行运行https://github.com/keras-team/keras-io/blob/master/examples/nlp/semantic_similarity_with_bert.py,https://github.com/keras-team/keras-io/blob/master/examples/nlp/semantic_similarity_with_bert.py(f“策略:{策略}”) model.summary()执行后,报告以下错误:
2021-08-29 00:16:22.311887: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
WARNING:tensorflow:Not all devices in `tf.distribute.Strategy` are visible to TensorFlow.
Traceback (most recent call last):
File "D:/.../PycharmProjects/.../Semantic Similarity with BERT.py", line 190, in <module>
bert_model = transformers.TFBertModel.from_pretrained("bert-base-uncased")
AttributeError: module 'transformers' has no attribute 'TFBertModel'发布于 2021-09-06 03:34:28
Tensorflow 2.6.0工作
pip install transformers
pip install tensorflow
from transformers import BertModel, TFBertModelhttps://stackoverflow.com/questions/68936716
复制相似问题