无法找到 Rasa 自定义组件

Unable to find Rasa custom component

我正在尝试在 Rasa 中添加自定义组件。 在尝试训练模型时编写自定义组件后,出现以下错误:

ModuleNotFoundError: No module named 'RasaCustomPy'

Exception: Failed to find component class for 'RasaCustomPy.my_module.MyCustomComponent'. Unknown component name. Check your configured pipeline and make sure the mentioned component is not misspelled. If you are creating your own component, make sure it is either listed as part of the `component_classes` in `rasa.nlu.registry.py` or is a proper name of a class in a module.

我的项目结构如下:

RasaCustomPy
|
|---__init__.py
|
|---actions.py
|
|---my_module.py
|
|---data
|
|---venv
|
|---config.yml
|
|---credentials.yml
|
|---domain.yml
|
|---endpoints.yml

config.yml 中,我尝试按如下方式添加我的自定义组件:

pipeline: 
- name: RasaCustomPy.my_module.MyCustomComponent

所有Rasa依赖包都安装在venv文件夹中。 当我在激活我的 virtualenv 后尝试使用命令 rasa train 训练它时出现错误。我正在使用 Rasa 1.0.7.

我是 Rasa 的新手,如有任何帮助,我们将不胜感激。

自定义组件路径未正确添加到 python 路径的问题已在 1.1.5 中修复,因此请确保您的版本高于该版本(通常包括您的版本您在 SO 帖子中使用的任何软件 运行 对任何试图 debug/replicate 您的问题的人都有帮助)

路径应该相对于你的配置所在的位置,所以在这种情况下,因为你已经在 RasaCustomPy 目录中,我想你想要

pipeline: 
 - name: my_module.MyCustomComponent

但如果这不起作用,请尝试调整文件路径。