当前位置:   article > 正文

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

chinese_l-12_h-768_a-12

天坑。

在使用库时报错:

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就可以了!

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

闽ICP备14008679号