Rasa X on aws

Hello, I have created a AWS server, and connected to Rasa X. From here I connected my assistant to it. The problem is, that when I talk to my bot, I can see that it says that the particular spacy model which I use is not found.

I don’t know if the problem is a spacy or Rasa problem, so I have created a discussion on spacys’ github aswell.

Update: I fixed the error by changing the language to english and back to danish, but the error returns if restart my server

Thanks in advance

Hi @Blaabjerg96

What is the error message you are seeing?

Hi @jjuzl

The error message is this:

Traceback (most recent call last): File "/opt/venv/lib/python3.8/site-packages/rasa/core/agent.py", line 161, in _update_model_from_server _load_and_set_updated_model(agent, model_directory, new_fingerprint) File "/opt/venv/lib/python3.8/site-packages/rasa/core/agent.py", line 134, in _load_and_set_updated_model interpreter = _load_interpreter(agent, nlu_path) File "/opt/venv/lib/python3.8/site-packages/rasa/core/agent.py", line 93, in _load_interpreter return rasa.core.interpreter.create_interpreter(nlu_path) File "/opt/venv/lib/python3.8/site-packages/rasa/core/interpreter.py", line 33, in create_interpreter return RasaNLUInterpreter(model_directory=obj) File "/opt/venv/lib/python3.8/site-packages/rasa/core/interpreter.py", line 127, in __init__ self._load_interpreter() File "/opt/venv/lib/python3.8/site-packages/rasa/core/interpreter.py", line 165, in _load_interpreter self.interpreter = Interpreter.load(self.model_directory) File "/opt/venv/lib/python3.8/site-packages/rasa/nlu/model.py", line 331, in load return Interpreter.create( File "/opt/venv/lib/python3.8/site-packages/rasa/nlu/model.py", line 405, in create component = component_builder.load_component( File "/opt/venv/lib/python3.8/site-packages/rasa/nlu/components.py", line 824, in load_component component = registry.load_component_by_meta( File "/opt/venv/lib/python3.8/site-packages/rasa/nlu/registry.py", line 177, in load_component_by_meta return component_class.load( File "/opt/venv/lib/python3.8/site-packages/rasa/nlu/utils/spacy_utils.py", line 309, in load nlp = cls.load_model(model_name) File "/opt/venv/lib/python3.8/site-packages/rasa/nlu/utils/spacy_utils.py", line 52, in load_model raise InvalidModelError( rasa.nlu.model.InvalidModelError: Please confirm that da_core_news_md is an available spaCy model. You need to download one upfront. For example: python -m spacy download en_core_web_md More informaton can be found on https://rasa.com/docs/rasa/components#spacynlp

This problem is also occuring when I add an intent. The assisant will only recognise the new intent if I change language → train it → upload it → change the language back to the original language → and upload again.

Is this somehow related?

Thanks in advance

How are you installing the spacy model? And are you also linking it e.g. python -m spacy link en_core_web_md en?

I didnt specifically download my model - I just connected it through github. Locally I ran the python -m spacy download command. I dont link it, due to the warning message saying it will be depricated, but should I link the model?

If you are using spacy 3.0 you don’t need to link, but you must use the full name in the config. see: Version Migration Guide

However if you are using an older version of spacy you must link the model.

So my spacy model is 3.0.0 which I assume is spacy version 3.0, so I would not have to link it

Could you show me the contents of your config.yaml?

Yes i will share it here

>   Configuration for Rasa NLU.
> https://rasa.com/docs/rasa/nlu/components/

> language: da
> 
> 
> No configuration for the NLU pipeline was provided. The following default pipeline was used to train your model.
> If you'd like to customize it, uncomment and adjust the pipeline.
> See https://rasa.com/docs/rasa/tuning-your-model for more information.
> pipeline:
> - name: SpacyNLP
>   model: da_core_news_md
> - name: SpacyTokenizer
> - name: SpacyEntityExtractor
> - name: SpacyFeaturizer
>   pooling: mean
> - name: CountVectorsFeaturizer
>   analyzer: char_wb
>   min_ngram: 1
>   max_ngram: 2
> - name: DIETClassifier
> - name: FallbackClassifier
>   threshold: 0.8
>   ambiguity_threshold: 0.1
> epochs: 1
> 
> 
> Configuration for Rasa Core.
> https://rasa.com/docs/rasa/core/policies/
> policies:
>  No configuration for policies was provided. The following default policies were used to train your model.
>  If you'd like to customize them, uncomment and adjust the policies.
>  See https://rasa.com/docs/rasa/policies for more information.
>   - name: "AugmentedMemoizationPolicy"
>     max_history: 10
>   -  name: TEDPolicy
>      max_history: 5
>      epochs: 100
>     constrain_similarities: true
>   - name: RulePolicy
>     core_fallback_threshold: 0.4
>     core_fallback_action_name: "action_default_fallback"
>     enable_fallback_prediction: True

That seems to work fine for me on my local machine after running python -m spacy download da_core_news_md .

Maybe you could try on your local machine too? I suspect the issue is something to do with the environment you are running this on AWS.

I have the model installed locally as well, but makes sense if the problem is AWS. But seems weird that it works for english, without the workarounds.

When it breaks you could try doing pip freeze | grep spacy and seeing if the module is there. It should have a line like:

da-core-news-md @ https://github.com/explosion/spacy-models/releases/download/da_core_news_md-3.0.0/da_core_news_md-3.0.0-py3-none-any.whl

If it’s not, then it could be something to do with your python environment.