[英]NameError: name 'BertModel' is not defined, error while importing Bert extractive summarizer
I have freshly installed Anaconda module and installed Bert extractive summarizer package.我刚刚安装了 Anaconda 模块并安装了 Bert 提取摘要程序包。 The following error is being encountered by me while importing the module:
我在导入模块时遇到以下错误:
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
Please help me in resolving this issue.请帮我解决这个问题。 Thanks in advance.
提前致谢。
Which version of python are you using.您使用的是哪个版本的python。 I face a similar error which i used python 3.5.x.
我遇到了类似的错误,我使用了 python 3.5.x。 This error got resolved once i uninstalled python3.5 and installed python 3.6
一旦我卸载了 python3.5 并安装了 python 3.6,这个错误就得到了解决
conda install python=3.6
Run this command and then restart your notebook.运行此命令,然后重新启动您的笔记本。 It will work
它会工作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.