C:\Users\Jinu Augustine\Documents\Solidaridad FAQ Bot>docker run 4145b1589e68
2020-08-21 15:46:25 INFO rasa_sdk.endpoint - Starting action endpoint server...
2020-08-21 15:46:25 INFO transformers.file_utils - PyTorch version 1.6.0 available.
2020-08-21 15:46:26 INFO root - Load pretrained SentenceTransformer: bert-base-nli-mean-tokens
2020-08-21 15:46:26 INFO root - Did not find a '/' or '\' in the name. Assume to download model from server.
Traceback (most recent call last):
File "/usr/local/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/app/rasa_sdk/__main__.py", line 34, in <module>
main()
File "/app/rasa_sdk/__main__.py", line 30, in main
main_from_args(cmdline_args)
File "/app/rasa_sdk/__main__.py", line 21, in main_from_args
args.auto_reload,
File "/app/rasa_sdk/endpoint.py", line 137, in run
action_package_name, cors_origins=cors_origins, auto_reload=auto_reload
File "/app/rasa_sdk/endpoint.py", line 80, in create_app
executor.register_package(action_package_name)
File "/app/rasa_sdk/executor.py", line 249, in register_package
self._import_submodules(package)
File "/app/rasa_sdk/executor.py", line 205, in _import_submodules
package = self._import_module(package)
File "/app/rasa_sdk/executor.py", line 226, in _import_module
module = importlib.import_module(name)
File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/app/actions.py", line 151, in <module>
encode_standard_question(sentence_transformer_select,pretrained_model)
File "/app/actions.py", line 135, in encode_standard_question
bc = SentenceTransformer(pretrained_model)
File "/opt/venv/lib/python3.7/site-packages/sentence_transformers/SentenceTransformer.py", line 48, in __init__
os.makedirs(model_path, exist_ok=True)
File "/usr/local/lib/python3.7/os.py", line 213, in makedirs
makedirs(head, exist_ok=exist_ok)
File "/usr/local/lib/python3.7/os.py", line 213, in makedirs
makedirs(head, exist_ok=exist_ok)
File "/usr/local/lib/python3.7/os.py", line 213, in makedirs
makedirs(head, exist_ok=exist_ok)
File "/usr/local/lib/python3.7/os.py", line 223, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/.cache'
我在尝试为rasa chatbot构建docker映像时遇到以下错误。 我能够构建docker映像,但是当我尝试运行该映像时,会发生以下错误。我对NLP使用句子转换器,并使用bert-base-nli-mean-tokens作为nli模型。不知道怎么了。
答案 0 :(得分:0)
问题在于有一个可写的目录路径来下载预训练模型。
SentenceTransformers Lib 使用 2 种方式读取此缓存目录路径(下载预训练模型的目录):-
在文件 SentenceTransformer.py#L55 中,它检查环境变量 SENTENCE_TRANSFORMERS_HOME
是否设置正确。所以你可以设置这个环境。 var 到您具有写入权限的目录。
如果环境。变种SENTENCE_TRANSFORMERS_HOME
未设置,它使用 pytorch 获取其缓存目录。 Pytorch 默认将 <HOME>./cache
(请参阅 here)作为缓存目录,但您可以通过设置环境变量 TORCH_HOME
来覆盖此选择。
现在,在您的情况下,它正在写入 /.cache
目录,这可能是因为用户为 docker 设置了/未设置。当你ssh到docker容器时,如果没有/home/username
目录,pytorch默认给出/.cache
目录(See here)。您可以使用以上 2 种方式来覆盖此路径。
例如,您可以将 env 值传递为:SENTENCE_TRANSFORMERS_HOME=./.config python train.py