gpt4 book ai didi

docker - 权限错误 : [Errno 13] Permission denied: '/.cache' - Error occurred while building a docker image

转载 作者:行者123 更新时间:2023-12-05 07:02:36 28 4
gpt4 key购买 nike

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 聊天机器人构建 docker 镜像时遇到以下错误。我能够构建 docker 镜像,但是当我尝试运行该镜像时,出现以下错误。我在 NLP 中使用句子转换器,并使用 bert-base-nli-mean-tokens 作为 nli 模型。不知道怎么回事。

最佳答案

问题是有一个可写的目录路径来下载预训练模型。

SentenceTransformers Lib 使用两种方式读取此缓存目录路径(下载预训练模型的目录):-

  1. 在文件中 SentenceTransformer.py#L55 , 它检查环境变量 SENTENCE_TRANSFORMERS_HOME设置正确。所以你可以设置这个环境。 var 到您具有写入权限的目录。

  2. 如果环境。变种。 SENTENCE_TRANSFORMERS_HOME没有设置,它使用pytorch来获取它的缓存目录。 Pytorch 默认给出 <HOME>./cache (参见 here )作为缓存目录,但您可以通过设置环境变量 TORCH_HOME 来覆盖此选择.

现在,在您的情况下,它正在写入 /.cache目录,可能是因为 docker 的用户 set/notset。当你ssh到docker容器时,如果没有/home/username目录,pytorch 给出 /.cache默认目录(See here)。您可以使用以上 2 种方式覆盖此路径。

例如,您可以将 env 值传递为:SENTENCE_TRANSFORMERS_HOME=./.config python train.py

关于docker - 权限错误 : [Errno 13] Permission denied: '/.cache' - Error occurred while building a docker image,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63526148/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com