Rasa X Docker Tarinning ModuleNotFoundError with a Custom Component

versions : [rasa-x : 0.40.1] [rasa : 2.6.2]

Hello.

I installed the RasaX as instructed by [Docker Compose Installation] ,and pulled code from a remote git repository.

The custom component is in rasa-x : /app/git/2/compoments/

config.yml:

pipeline:
- name: compoments.nlu.tokenizers.bert_tokenizer.CustomBertTokenizer
    cache_dir: ./tmp
    model_weights: pre_models
- name: LanguageModelFeaturizer
    cache_dir: ./tmp
    model_name: bert
    model_weights: pre_models
- name: DIETClassifier
    epochs: 100
    constrain_similarities: True
    model_confidence: linear_norm
- name: RegexEntityExtractor
- name: EntitySynonymMapper
- name: ResponseSelector
    epochs: 100
    retrieval_intent: rasa_faq
- name: FallbackClassifier
    threshold: 0.3
    ambiguity_threshold: 0.1

When I training a model, rasa-worker throws a sequence of errors:

Traceback (most recent call last):
File "/opt/venv/lib/python3.8/site-packages/rasa/server.py", line 1055, in train
    training_result = await train_async(**training_payload)
File "/opt/venv/lib/python3.8/site-packages/rasa/model_training.py", line 108, in train_async
    return await _train_async_internal(
File "/opt/venv/lib/python3.8/site-packages/rasa/model_training.py", line 289, in _train_async_internal
    await _do_training(
File "/opt/venv/lib/python3.8/site-packages/rasa/model_training.py", line 335, in _do_training
    model_path = await _train_nlu_with_validated_data(
File "/opt/venv/lib/python3.8/site-packages/rasa/model_training.py", line 759, in _train_nlu_with_validated_data
    await rasa.nlu.train.train(
File "/opt/venv/lib/python3.8/site-packages/rasa/nlu/train.py", line 97, in train
    trainer = Trainer(
File "/opt/venv/lib/python3.8/site-packages/rasa/nlu/model.py", line 162, in __init__
    components.validate_requirements(cfg.component_names)
File "/opt/venv/lib/python3.8/site-packages/rasa/nlu/components.py", line 70, in validate_requirements
    component_class = registry.get_component_class(component_name)
File "/opt/venv/lib/python3.8/site-packages/rasa/nlu/registry.py", line 148, in get_component_class
    raise ComponentNotFoundException(
rasa.nlu.registry.ComponentNotFoundException: Failed to load the component 'compoments.nlu.tokenizers.bert_tokenizer.CustomBertTokenizer'. Failed to find module 'compoments.nlu.tokenizers.bert_tokenizer'. Either your pipeline configuration contains an error or the module you are trying to import is broken (e.g. the module is trying to import a package that is not installed). Traceback (most recent call last):
File "/opt/venv/lib/python3.8/site-packages/rasa/nlu/registry.py", line 121, in get_component_class
    return rasa.shared.utils.common.class_from_module_path(component_name)
File "/opt/venv/lib/python3.8/site-packages/rasa/shared/utils/common.py", line 37, in class_from_module_path
    m = importlib.import_module(module_name)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'compoments'

How can I load the custom component during pipeline execution, or do I need to mount it in advance? Thanks.

Hi @lynndisco! I haven’t tried it myself, but I saw this forum thread with an example for how to include the custom component in the docker-compose file. Let me know if this works for you or if you need more help!

It’s works for me , thanks !