Rasa Pipeline Question

Hello Rasa Community! I am a little confused with the syntax on how pipelines are set up in the config file. On the official documentation, it indicated the following will work:

pipeline:

-name: pretrained_embeddings_spacy

But as soon as I train the bot, get the following errors:

    Traceback (most recent call last):
      File "c:\programdata\anaconda3\envs\rasa_workshop\lib\site-packages\rasa\nlu\registry.py", line 154, in get_component_class
        return class_from_module_path(component_name)
      File "c:\programdata\anaconda3\envs\rasa_workshop\lib\site-packages\rasa\utils\common.py", line 208, in class_from_module_path
        raise ImportError(f"Cannot retrieve class from path {module_path}.")
    ImportError: Cannot retrieve class from path pretrained_embeddings_spacy.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\programdata\anaconda3\envs\rasa_workshop\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\programdata\anaconda3\envs\rasa_workshop\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\ProgramData\Anaconda3\envs\rasa_workshop\Scripts\rasa.exe\__main__.py", line 7, in <module>
  File "c:\programdata\anaconda3\envs\rasa_workshop\lib\site-packages\rasa\__main__.py", line 76, in main
    cmdline_arguments.func(cmdline_arguments)
  File "c:\programdata\anaconda3\envs\rasa_workshop\lib\site-packages\rasa\cli\train.py", line 76, in train
    kwargs=extract_additional_arguments(args),
  File "c:\programdata\anaconda3\envs\rasa_workshop\lib\site-packages\rasa\train.py", line 46, in train
    kwargs=kwargs,
  File "c:\programdata\anaconda3\envs\rasa_workshop\lib\asyncio\base_events.py", line 573, in run_until_complete
    return future.result()
  File "c:\programdata\anaconda3\envs\rasa_workshop\lib\site-packages\rasa\train.py", line 97, in train_async
    kwargs,
  File "c:\programdata\anaconda3\envs\rasa_workshop\lib\site-packages\rasa\train.py", line 184, in _train_async_internal
    kwargs=kwargs,
  File "c:\programdata\anaconda3\envs\rasa_workshop\lib\site-packages\rasa\train.py", line 241, in _do_training
    persist_nlu_training_data=persist_nlu_training_data,
  File "c:\programdata\anaconda3\envs\rasa_workshop\lib\site-packages\rasa\train.py", line 470, in _train_nlu_with_validated_data
    persist_nlu_training_data=persist_nlu_training_data,
  File "c:\programdata\anaconda3\envs\rasa_workshop\lib\site-packages\rasa\nlu\train.py", line 68, in train
    trainer = Trainer(nlu_config, component_builder)
  File "c:\programdata\anaconda3\envs\rasa_workshop\lib\site-packages\rasa\nlu\model.py", line 148, in __init__
    components.validate_requirements(cfg.component_names)
  File "c:\programdata\anaconda3\envs\rasa_workshop\lib\site-packages\rasa\nlu\components.py", line 38, in validate_requirements
    component_class = registry.get_component_class(component_name)
  File "c:\programdata\anaconda3\envs\rasa_workshop\lib\site-packages\rasa\nlu\registry.py", line 180, in get_component_class
    raise ModuleNotFoundError(exception_message)
ModuleNotFoundError: Cannot find class 'pretrained_embeddings_spacy' from global namespace. Please check that there is no typo in the class name and that you have imported the class into the global namespace.

And when I switch the syntax back to:

pipeline: pretrained_embeddings_spacy

The training went through without issues.

As of now, I am confused about the syntax and a little concerned about not being able to utilize multiple pipelines as my chatbot project grows.

Thanks in advanced for looking into this, Rasa Community!

I agree, the syntax is a little confusing. Instead of using the whole pipeline, you can just add the components that are needed, this way, if there are components from different pipelines, you can use it without any issues.

pipeline:

  • name: “WhitespaceTokenizer”
  • name: “CountVectorsFeaturizer”
  • name: “EmbeddingIntentClassifier” …

What exactly did pretrained_embeddings_spacy cover, as far as pipelines are concerned, maybe I could just break it down in the config file to add more on top of what spacy has already.

This image is from rasa pipeline docs.

I hope this answers your question. You can select one pipeline and then can add additional components however required or only add the components seperately, without specifying the pipeline.