当前位置:   article > 正文

下载Bert-base-Chinese失败_bert预训练模型下载不下来

bert预训练模型下载不下来

代码:

tokenizer = AutoTokenizer.from_pretrained("bert-base-chinese")
model = AutoModel.from_pretrained("bert-base-chinese")

错误如下所示:

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 bert-base-chinese 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'.

解决方法

手动下载 需要的权重文件和配置文件,然后再次加载

1. 访问 https://huggingface.co/models 网站,输入我们想要的与训练模型

google-bert/bert-base-chinese at main

2. 找到我们的需要的权重文件 .bin 文件 和 配置文件 config.json ,点击下载

3. 将我们下载的文件,放入到指定的文件夹中

4. 再次运行,查看情况

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小桥流水78/article/detail/774126
推荐阅读
相关标签
  

闽ICP备14008679号