ValueError: Connection error, and we cannot find the requested files in the cached path. Please try

在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加载预训练模型。

 

 

  • 3
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 10
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值