我新安装了Anaconda模块,并安装了Bert提取摘要程序包。导入模块时遇到以下错误:
from transformers import *
from summarizer import Summarizer
~\anaconda3\lib\site-packages\summarizer\model_processors.py in <module>
----> 1 from summarizer.bert_parent import BertParent
2 from summarizer.cluster_features import ClusterFeatures
3 from summarizer.sentence_handler import SentenceHandler
4 from typing import List
5 from abc import abstractmethod
~\anaconda3\lib\site-packages\summarizer\bert_parent.py in <module>
9
10
---> 11 class BertParent(object):
12
13 """
~\anaconda3\lib\site-packages\summarizer\bert_parent.py in BertParent()
16
17 MODELS = {
---> 18 'bert-base-uncased': (BertModel, BertTokenizer),
19 'bert-large-uncased': (BertModel, BertTokenizer),
20 'xlnet-base-cased': (XLNetModel, XLNetTokenizer),
NameError: name 'BertModel' is not defined
请帮助我解决此问题。预先感谢。
答案 0 :(得分:0)
您正在使用哪个版本的python。我遇到了使用python 3.5.x的类似错误。一旦我卸载python3.5并安装了python 3.6,此错误就得到解决
conda install python=3.6
运行此命令,然后重新启动笔记本计算机。会起作用