Как запустить докер-контейнер чтобы не скачивались файлы для модели?

Добрый день!
Я запускаю докер с моделью sqaud. Он запускается, REST API работает. Но каждый раз происходит скачивание большого файла (судя по всему самой модели). Хотя я делаю все по инструкции и модель должна браться с диска.

Команда запуска:
docker run -e CONFIG=squad_ru_torch_bert -p 5555:5000 -v ~/.deeppavlov:/root/.deeppavlov -v /home/kuruhuru/.local/share/virtualenvs/nlp:/venv deeppavlov/base-cpu

Лог
2022-09-21 05:19:58.744 INFO in ‘deeppavlov.core.common.file’[‘file’] at line 32: Interpreting ‘squad_ru_torch_bert’ as ‘/base/DeepPavlov/deeppavlov/configs/squad/squad_ru_torch_bert.json’
2022-09-21 05:20:04.686 INFO in ‘deeppavlov.download’[‘download’] at line 138: Skipped http://files.deeppavlov.ai/v1/squad/squad_ru_torch_bert.tar.gz?config=squad_ru_torch_bert download because of matching hashes
Downloading: 100%|██████████| 642/642 [00:00<00:00, 139kB/s]
Downloading: 100%|██████████| 1.65M/1.65M [00:03<00:00, 489kB/s]
Downloading: 100%|██████████| 112/112 [00:00<00:00, 22.8kB/s]
Downloading: 100%|██████████| 24.0/24.0 [00:00<00:00, 7.62kB/s]
2022-09-21 05:20:20.99 INFO in ‘deeppavlov.models.torch_bert.torch_transformers_squad’[‘torch_transformers_squad’] at line 246: From pretrained DeepPavlov/rubert-base-cased.
Downloading: 100%|██████████| 714M/714M [02:15<00:00, 5.26MB/s]
Some weights of the model checkpoint at DeepPavlov/rubert-base-cased were not used when initializing BertForQuestionAnswering: [‘cls.seq_relationship.weight’, ‘cls.predictions.bias’, ‘cls.predictions.decoder.weight’, ‘cls.seq_relationship.bias’, ‘cls.predictions.transform.dense.bias’, ‘cls.predictions.transform.LayerNorm.bias’, ‘cls.predictions.decoder.bias’, ‘cls.predictions.transform.dense.weight’, ‘cls.predictions.transform.LayerNorm.weight’]

  • This IS expected if you are initializing BertForQuestionAnswering from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).
  • This IS NOT expected if you are initializing BertForQuestionAnswering from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).
    Some weights of BertForQuestionAnswering were not initialized from the model checkpoint at DeepPavlov/rubert-base-cased and are newly initialized: [‘qa_outputs.weight’, ‘qa_outputs.bias’]
    You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.
    2022-09-21 05:22:40.514 INFO in ‘deeppavlov.models.torch_bert.torch_transformers_squad’[‘torch_transformers_squad’] at line 275: Load path /root/.deeppavlov/models/squad_ru_torch_bert/DeepPavlov/rubert-base-cased/model is given.
    2022-09-21 05:22:40.515 INFO in ‘deeppavlov.models.torch_bert.torch_transformers_squad’[‘torch_transformers_squad’] at line 282: Load path /root/.deeppavlov/models/squad_ru_torch_bert/DeepPavlov/rubert-base-cased/model.pth.tar exists.
    2022-09-21 05:22:40.515 INFO in ‘deeppavlov.models.torch_bert.torch_transformers_squad’[‘torch_transformers_squad’] at line 283: Initializing TorchTransformersSquad from saved.
    2022-09-21 05:22:40.515 INFO in ‘deeppavlov.models.torch_bert.torch_transformers_squad’[‘torch_transformers_squad’] at line 286: Loading weights from /root/.deeppavlov/models/squad_ru_torch_bert/DeepPavlov/rubert-base-cased/model.pth.tar.
    2022-09-21 05:22:45.807 INFO in ‘deeppavlov.core.models.torch_model’[‘torch_model’] at line 102: Model was successfully initialized!

@kuruhuru
Здравствуйте.
Чтобы модель трансформеров не качалась при каждом запуске, добавьте маппинг -v ~/.cache:/root/.cache.

1 Like