pytorch_pretrained_bert库报错: Model name ‘pretrained\chinese_L-12_H-768_A-12‘ was not found in model

天坑。

在使用库时报错:

Model name ‘pretrained\chinese_L-12_H-768_A-12’ was not found in model name list (bert-base-uncased, bert-large-uncased, bert-base-cased, bert-large-cased, bert-base-multilingual-uncased, bert-base-multilingual-cased, bert-base-chinese). We assumed ‘pretrained\chinese_L-12_H-768_A-12\vocab.txt’ was a path or url but couldn’t find any file associated to this path or url.

备注:我用的是PyTorch版本的预训练模型,不清楚Tensorflow的会不会出现这个问题。

230417更新解决:
兄弟们,不用老办法了,直接huggingface官网的model上,搜索下载模型全套需要的就行!!!
https://huggingface.co/models

上面这个例子:
在这里插入图片描述

解决:
不仅要有从https://github.com/Meelfy/pytorch_pretrained_BERT上下载的PyTorch版的预训练模型,还要有vocab.txt,你看看你的pretrained\chinese_L-12_H-768_A-12文件下面是不是没有vocab.txt!

在谷歌的官方bert中,https://github.com/google-research/bert,可以界面搜索’chinese‘,然后下载的文件中解压有vocab.txt文件,放到pretrained\chinese_L-12_H-768_A-12就可以了!

  • 2
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 24
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值