[英]Unable to find Rasa custom component
I am trying to add a custom component in Rasa. 我正在尝试在Rasa中添加自定义组件。 After writing my custom component when I tried to train my model, I got the following errors:
在尝试训练模型时编写了自定义组件后,出现以下错误:
ModuleNotFoundError: No module named 'RasaCustomPy'
and 和
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.
My project has the following structure: 我的项目具有以下结构:
RasaCustomPy
|
|---__init__.py
|
|---actions.py
|
|---my_module.py
|
|---data
|
|---venv
|
|---config.yml
|
|---credentials.yml
|
|---domain.yml
|
|---endpoints.yml
Inside config.yml
, I have tried to add my custom component as follows: 在
config.yml
内部,我尝试添加自定义组件,如下所示:
pipeline:
- name: RasaCustomPy.my_module.MyCustomComponent
All Rasa dependency packages are installed inside the venv
folder. 所有Rasa依赖包都安装在
venv
文件夹中。 I get the error when I tried to train it using the command rasa train
after activating my virtualenv. 激活virtualenv后,尝试使用命令
rasa train
对其进行训练时出现错误。 I am using Rasa 1.0.7. 我正在使用Rasa 1.0.7。
I am new to Rasa and any help would be appreciated. 我是Rasa的新手,任何帮助将不胜感激。
the issue of custom component paths not being correctly added to the python path was fixed in 1.1.5, so make sure that you have a version that is later than that one (in general including your version of whatever software you're running in SO posts is helpful for anyone trying to debug/replicate your issue) 自定义组件路径未正确添加到python路径的问题已在1.1.5中修复,因此请确保您使用的版本晚于该版本(通常包括您正在SO中运行的任何软件的版本)帖子对尝试调试/复制您的问题的人很有帮助)
The paths should be relative to where your config is located, so in this case, as you're already in the RasaCustomPy directory, I think you want 路径应该相对于配置所在的位置,因此在这种情况下,因为您已经在RasaCustomPy目录中,所以我想
pipeline:
- name: my_module.MyCustomComponent
but if that doesn't work, try playing around with the path to the file. 但是,如果这样不起作用,请尝试播放文件的路径。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.