Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Module for policy 'EntitySynonymMapper' could not be loaded. #4819

Closed
Krogsager opened this issue Nov 22, 2019 · 1 comment
Closed
Labels
type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors.

Comments

@Krogsager
Copy link

Krogsager commented Nov 22, 2019

Rasa version: 1.4.5

Rasa X version (if used & relevant): 0.22.2

Python version: 3.7.5 AND 3.6.9

Operating system (windows, osx, ...): Ubuntu 18.04.3 LTS

Issue:
I've added EntitySynonymMapper to my config.yml in the RasaX UI. When I click Train, I get an error message.
I've tested this in a fresh docker container in both python 36 and 37.

Error when I press Train in UI:
Error (including full traceback):

Training Core model...
2019-11-22 09:49:57 ERROR    rasax.community.api.blueprints.models  - 500, Internal Server Error, body='b'{"version":"1.4.5","status":"failure","message":"An unexpected error occurred during training. 
Error: Module for policy \'EntitySynonymMapper\' could not be loaded. Please make sure the name is a valid policy.","reason":"TrainingError","details":{},"help":null,"code":500}''    

Error when I train from the command line:
Command or request that led to error:

rasa train

Error (including full traceback):

2019-11-22 09:57:39 INFO     rasa.model  - Data (core-config) for Core model changed.
�[94mTraining Core model...�[0m
2019-11-22 09:57:44 INFO     absl  - Entry Point [tensor2tensor.envs.tic_tac_toe_env:TicTacToeEnv] registered with id [T2TEnv-TicTacToeEnv-v0]
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/rasa/core/policies/ensemble.py", line 319, in from_dict
    constr_func = registry.policy_from_module_path(policy_name)
  File "/usr/local/lib/python3.6/site-packages/rasa/core/registry.py", line 21, in policy_from_module_path
    module_path, lookup_path="rasa.core.policies.registry"
  File "/usr/local/lib/python3.6/site-packages/rasa/utils/common.py", line 191, in class_from_module_path
    return getattr(m, module_path)
AttributeError: module 'rasa.core.policies.registry' has no attribute 'EntitySynonymMapper'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/rasa", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/site-packages/rasa/__main__.py", line 76, in main
    cmdline_arguments.func(cmdline_arguments)
  File "/usr/local/lib/python3.6/site-packages/rasa/cli/train.py", line 76, in train
    kwargs=extract_additional_arguments(args),
  File "/usr/local/lib/python3.6/site-packages/rasa/train.py", line 45, in train
    kwargs=kwargs,
  File "uvloop/loop.pyx", line 1456, in uvloop.loop.Loop.run_until_complete
  File "/usr/local/lib/python3.6/site-packages/rasa/train.py", line 96, in train_async
    kwargs,
  File "/usr/local/lib/python3.6/site-packages/rasa/train.py", line 182, in _train_async_internal
    kwargs=kwargs,
  File "/usr/local/lib/python3.6/site-packages/rasa/train.py", line 217, in _do_training
    kwargs=kwargs,
  File "/usr/local/lib/python3.6/site-packages/rasa/train.py", line 346, in _train_core_with_validated_data
    kwargs=kwargs,
  File "/usr/local/lib/python3.6/site-packages/rasa/core/train.py", line 43, in train
    policies = config.load(policy_config)
  File "/usr/local/lib/python3.6/site-packages/rasa/core/config.py", line 28, in load
    return PolicyEnsemble.from_dict(config_data)
  File "/usr/local/lib/python3.6/site-packages/rasa/core/policies/ensemble.py", line 327, in from_dict
    "".format(policy_name)
rasa.core.policies.ensemble.InvalidPolicyConfig: Module for policy 'EntitySynonymMapper' could not be loaded. Please make sure the name is a valid policy.

Content of configuration file (config.yml) (if relevant):

language: en
pipeline: supervised_embeddings
policies:
  - name: MemoizationPolicy
  - name: KerasPolicy
  - name: MappingPolicy
  - name: EntitySynonymMapper

The Dockerfile I used:
(only change the first line, FROM python:3.7-stretch to FROM python:3.6-stretch)

FROM python:3.7-stretch
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

RUN pip install --upgrade pip
RUN pip install rasa-x --extra-index-url https://pypi.rasa.com/simple

RUN useradd --create-home appuser
WORKDIR /home/appuser
USER appuser

RUN rasa init --no-prompt
CMD ["rasa","x","--no-prompt","--log-file","log"]


@Krogsager Krogsager added the type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors. label Nov 22, 2019
@erohmensing
Copy link
Contributor

erohmensing commented Nov 22, 2019

@Krogsager EntitySynonymMapper is part of the NLU pipeline, not a policy. It is actually already part of the supervised_embeddings pipeline, so you don't need to add it. Simply remove it from the policies list and it should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors.
Projects
None yet
Development

No branches or pull requests

2 participants