在autodl上运行模型PAIE出现错误:
ValueError: Connection error, and we cannot find the requested files in the cached path. Please try again or make sure your Internet connection is on.
之前都能正常执行,这两天突然出现这种错误,试过重新上传模型导入依赖,还是无法解决。
寻找原因:
从给定网址'https://huggingface.co' 加载预训练模型时,连接失败。
更改torchvision版本后重试,还是有错。但也能下载模型
更换huggingface-hub和transfomers版本,出错
Traceback (most recent call last):
File "engine.py", line 68, in <module>
main()
File "engine.py", line 58, in main
model, tokenizer, optimizer, scheduler = build_model(args, args.model_type)
File "/root/PAIE-main/models/__init__.py", line 27, in build_model
config = config_class.from_pretrained(args.model_name_or_path)
File "/root/miniconda3/lib/python3.8/site-packages/transformers/configuration_utils.py", line 547, in from_pretrained
config_dict, kwargs = cls.get_config_dict(pretrained_model_name_or_path, **kwargs)
File "/root/miniconda3/lib/python3.8/site-packages/transformers/configuration_utils.py", line 574, in get_config_dict
config_dict, kwargs = cls._get_config_dict(pretrained_model_name_or_path, **kwargs)
File "/root/miniconda3/lib/python3.8/site-packages/transformers/configuration_utils.py", line 629, in _get_config_dict
resolved_config_file = cached_file(
File "/root/miniconda3/lib/python3.8/site-packages/transformers/utils/hub.py", line 452, in cached_file
raise EnvironmentError(
OSError: We couldn't connect to 'https://huggingface.co' to load this file, couldn't find it in the cached files and it looks like facebook/bart-base is not the path to a directory containing a file named config.json.
Checkout your internet connection or see how to run the library in offline mode at 'https://huggingface.co/docs/transformers/installation#offline-mode'.
重新下载requirements.txt中的依赖,不再受限于版本,之后再缺什么依赖包,直接“pip install 依赖”即可,不用在下载对应的版本。成功连接huggingface加载预训练模型。