首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >AttributeError:模块“transformers”没有特性“”TFBertModel“”

AttributeError:模块“transformers”没有特性“”TFBertModel“”
EN

Stack Overflow用户
提问于 2021-08-26 10:19:05
回答 1查看 101关注 0票数 0

我的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.pyhttps://github.com/keras-team/keras-io/blob/master/examples/nlp/semantic_similarity_with_bert.py(f“策略:{策略}”) model.summary()执行后,报告以下错误:

代码语言:javascript
复制
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'
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-09-06 03:34:28

Tensorflow 2.6.0工作

代码语言:javascript
复制
pip install transformers
pip install tensorflow 
from transformers import BertModel, TFBertModel
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68936716

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档