Hugging Face 无法连接问题 OSError: We couldn‘t connect to ‘https://huggingface
- Hugging Face 无法连接问题 OSError: We couldn‘t connect to ‘https://huggingface.co‘ to load this file 解决方案
-
- Hugging Face 无法连接问题 OSError: We couldn‘t connect to ‘https://huggingface.co‘ to load this file 解决方案
-
- 今天打算用一下`hugging face`的`BERT模型`,跑代码的时候显示连接不了,应该是`hugging face`的网站不稳定,国内连接比较困难。报错信息如下:
- 解决方案很简单,根据报错的提示,打开`Hugging Face官网`,将所需要的模型下载到本地,更改一下引用路径就可以啦!
-
- step 1:打开`Hugging Face官网`[https://huggingface.co/docs/transformers/installation#offline-mode](https://huggingface.co/docs/transformers/installation#offline-mode):
- step 2:搜索你需要的模型,点击`Files and version`,这里是`bert-base-uncased`:
- step 3:根据你的框架选择合适的文件,我用的是`pytorch` (如果是`TensorFlow`就将`pytorch_model.bin`换成`tf_model.h5`就好啦),选择以下五个文件下载到本地:
- step 4:将下载好的文件放在你需要的目录下,比如我这里建立了一个`bert-base-uncased文件夹`存放:
- step 5:将用到的地方改成你自己的路径就可以啦!
- 底下评论
- OSError: We couldn‘t connect to ‘https://huggingface.co‘ to load this file,
- 场景:
- centOs安装git-lfs并下载huggingface模型
- hf模型都是用git-lfs托管的,可以直接git下载的,天才第一步: