【问题标题】:ImportError: cannot import name 'RasaNLUConfig' from 'rasa_nlu.config' in Google ColaboratoryImportError:无法从 Google Colaboratory 中的“rasa_nlu.config”导入名称“RasaNLUConfig”
【发布时间】:2021-10-19 03:58:23
【问题描述】:

我正在尝试制作 NLU 模型。当我跑步时

from rasa_nlu.config import RasaNLUConfig

我收到一个错误:

ImportError                               Traceback (most recent call last)
<ipython-input-1-c2bca1b53b6f> in <module>
----> 1 from rasa_nlu.config import RasaNLUConfig
      2 from rasa_nlu.model import Trainer

ImportError: cannot import name 'RasaNLUConfig' from 'rasa_nlu.config' (/usr/local/lib/python3.7/dist-packages/rasa_nlu/config.py)

我想,“嗯,不是什么大问题,Colaboratory 只是默认没有安装 Rasa,我就安装它”。 因此,当我使用!pip install rasa_nlu 安装它时,它完成了所有操作,然后它告诉我重新启动运行时并给了我一个按钮来执行此操作。我这样做了,然后我跑了from rasa_nlu.config import RasaNLUConfig,我仍然得到同样的错误:

ImportError: cannot import name 'RasaNLUConfig' from 'rasa_nlu.config'

我不熟悉!apt,所以我不知道应该如何安装 Rasa。问题会因此得到解决吗?还是别的什么?

【问题讨论】:

  • 如果您重新启动运行时,那么我猜该模块不再存在。尝试安装后立即导入。
  • 还是不行……
  • rasa_nlu 是否出现在 pip 列表中?
  • 是的,事实上,当我运行!pip list 时,有一大堆 rasa 模块:` rasa 2.8.10 rasa-core 0.9.0a2 rasa-nlu 0.12.3 rasa-sdk `跨度>

标签: python nlp rasa nlu


【解决方案1】:

看起来我使用的是较新版本的 rasa_nlu (0.15.1)。我正在关注的教程使用 0.11.3。在 0.11.3 中,RasaNLUConfig 位于 from rasa_nlu.config。但在 0.15.1 中,它在其他地方。

所以...解决了!

【讨论】:

    猜你喜欢
    • 2019-10-15
    • 1970-01-01
    • 1970-01-01
    • 2022-01-22
    • 2021-06-30
    • 2020-10-19
    • 2018-08-13
    • 2015-01-26
    • 2020-10-10
    相关资源
    最近更新 更多