Dr.Toms 2022-04-03 23:00 采纳率: 50%
浏览 721
已结题

OSError: [E941] Can't find model 'en'. It looks like you're trying to load a model from a shortcut

问题遇到的现象和发生背景

在使用chatterbot训练模型的时候,发生这个报错

问题相关代码,请勿粘贴截图

from chatterbot import ChatBot
import spacy
from chatterbot.trainers import ListTrainer
chatbot = ChatBot("Ron Obvious")
nlp = spacy.load("en_core_web_lg")
conversation = [
"Hello",
"Hi there!",
"How are you doing?",
"I'm doing great.",
"That is good to hear",
"Thank you.",
"You're welcome."
]
trainer = ListTrainer(chatbot)
trainer.train(conversation)
response = chatbot.get_response("Good morning!")
print(response)

运行结果及报错内容

C:\pyChrm123\mangshe\python.exe C:/Users/流浪猫汤姆/PycharmProjects/NLP/main.py
Traceback (most recent call last):
File "C:/Users/流浪猫汤姆/PycharmProjects/NLP/main.py", line 4, in
chatbot = ChatBot("Ron Obvious")
File "C:\pyChrm123\mangshe\lib\site-packages\chatterbot\chatterbot.py", line 28, in init
self.storage = utils.initialize_class(storage_adapter, **kwargs)
File "C:\pyChrm123\mangshe\lib\site-packages\chatterbot\utils.py", line 33, in initialize_class
return Class(*args, **kwargs)
File "C:\pyChrm123\mangshe\lib\site-packages\chatterbot\storage\sql_storage.py", line 20, in init
super().init(**kwargs)
File "C:\pyChrm123\mangshe\lib\site-packages\chatterbot\storage\storage_adapter.py", line 21, in init
'tagger_language', languages.ENG
File "C:\pyChrm123\mangshe\lib\site-packages\chatterbot\tagging.py", line 13, in init
self.nlp = spacy.load(self.language.ISO_639_1.lower())
File "C:\pyChrm123\mangshe\lib\site-packages\spacy_init_.py", line 52, in load
name, vocab=vocab, disable=disable, exclude=exclude, config=config
File "C:\pyChrm123\mangshe\lib\site-packages\spacy\util.py", line 426, in load_model
raise IOError(Errors.E941.format(name=name, full=OLD_MODEL_SHORTCUTS[name])) # type: ignore[index]
OSError: [E941] Can't find model 'en'. It looks like you're trying to load a model from a shortcut, which is obsolete as of spaCy v3.0. To load the model, use its full name instead:

nlp = spacy.load("en_core_web_sm")

For more details on the available models, see the models directory: https://spacy.io/models. If you want to create a blank model, use spacy.blank: nlp = spacy.blank("en")

Process finished with exit code 1

我的解答思路和尝试过的方法

en包的lg版本我已经pip安装了,但是还是报错,load不到sm后缀的包,可是我已经在代码前面声明load的是lg后缀的包,搞不懂它为什么还要报错sm后缀的包。
OSError: [E941] Can't find model 'en'. It looks like you're trying to load a model from a shortcut, which is obsolete as of spaCy v3.0. To load the model, use its full name instead:
针对这个报错结果,我试过注释报错代码,但是训练途中就会异常中断,结果如下:

img


E941报错是util.py文件里的 if name in OLD_MODEL_SHORTCUTS:
raise IOError(Errors.E941.format(name=name, full=OLD_MODEL_SHORTCUTS[name])) # type: ignore[index]
raise IOError(Errors.E050.format(name=name))
我想找一下OLD_MODEL_SHORTCUTS,但是在相调用的py文件里都没找到类似字符,我试过把报错信息注释,他就会训练到一半中断

我想要达到的结果
  • 写回答

2条回答 默认 最新

  • CSDN专家-HGJ 2022-04-03 23:42
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 4月12日
  • 已采纳回答 4月4日
  • 创建了问题 4月3日

悬赏问题

  • ¥30 STM32 INMP441无法读取数据
  • ¥100 求汇川机器人IRCB300控制器和示教器同版本升级固件文件升级包
  • ¥15 用visualstudio2022创建vue项目后无法启动
  • ¥15 x趋于0时tanx-sinx极限可以拆开算吗
  • ¥500 把面具戴到人脸上,请大家贡献智慧
  • ¥15 任意一个散点图自己下载其js脚本文件并做成独立的案例页面,不要作在线的,要离线状态。
  • ¥15 各位 帮我看看如何写代码,打出来的图形要和如下图呈现的一样,急
  • ¥30 c#打开word开启修订并实时显示批注
  • ¥15 如何解决ldsc的这条报错/index error
  • ¥15 VS2022+WDK驱动开发环境