【发布时间】:2020-11-04 12:58:23
【问题描述】:
目前我正在使用变压器(3.0.2)和python(3.7.3),遇到以下错误:
无法从“变压器”导入名称“TFBertForQuestionAnswering”
from transformers import BertTokenizer, TFBertForQuestionAnswering
model = TFBertForQuestionAnswering.from_pretrained('bert-base-cased')
f = open(model_path, "wb")
pickle.dump(model, f)
如何解决这个问题?
【问题讨论】:
-
你安装了 TensorFlow 吗?如果没有,请尝试
pip install tensorflow。如果是,请尝试在交互式 Python shell 中导入TFBertForQuestionAnswering。它可能会为您提供比运行脚本时更详细的错误消息。
标签: python pip huggingface-transformers question-answering