How do i link a custom language model to Rasa X deployment?

Hi there!

I’m using a custom pretrained language model in my bot with following pipeline:

language: ru
pipeline:
  - name: HFTransformersNLP
    model_weights: ./pretrained/rubert-base-cased_tf2/
    model_name: "bert"
  - name: LanguageModelTokenizer
  - name: LanguageModelFeaturizer
  - name: DIETClassifier
    epochs: 200
  - name: EntitySynonymMapper
  - name: ResponseSelector
    epochs: 100

It works as expected via rasa shell. Now I want to deploy the model with Rasa X Docker-compose.

If i simply upload the new trained model, rasa-production container logs an error:

OSError: Model name './pretrained/rubert-base-cased_tf2/' was not found in tokenizers model name list (bert-base-uncased, bert-large-uncased, bert-base-cased, bert-large-cased, bert-base-multilingual-uncased, bert-base-multilingual-cased, bert-base-chinese, bert-base-german-cased, bert-large-uncased-whole-word-masking, bert-large-cased-whole-word-masking, bert-large-uncased-whole-word-masking-finetuned-squad, bert-large-cased-whole-word-masking-finetuned-squad, bert-base-cased-finetuned-mrpc, bert-base-german-dbmdz-cased, bert-base-german-dbmdz-uncased, bert-base-finnish-cased-v1, bert-base-finnish-uncased-v1, bert-base-dutch-cased). We assumed './pretrained/rubert-base-cased_tf2/' was a path or url to a directory containing vocabulary files named ['vocab.txt'], but couldn't find such vocabulary files at this path or url.

Then I try attaching the folder as a volume:

rasa-production:
    <<: *default-rasa-service
    volumes:
      -  ./pretrained:/app/pretrained
    environment:
      <<: *rasa-credentials
      RASA_ENVIRONMENT: "production"
      DB_DATABASE: "tracker"
      RASA_MODEL_SERVER: "http://rasa-x:5002/api/projects/default/models/tags/production"

It attaches correctly, but the rasa-production instance starts restarting continuously. And nothing works again.

So how do I link the model correctly?

Hi @dstenyushkin, welcome to the forum!

It looks like the model is not successfully mounted at the expected path /app/pretrained. What directory are you starting docker-compose up -d from? Are you starting it in /etc/rasa? If so, please make sure you have a folder /etc/rasa/pretrained that contains your language model (/etc/rasa/pretrained/rubert-base-cased_tf2).

Let me know if that helps

Thank you for the hint. It was mounted properly. Actually the problem was memory restriction. I extended my container’s limit and it worked.