问题:
OSError: Error no file named pytorch_model.bin, tf_model.h5, model.ckpt.index or flax_model.msgpack found in directory
出现过程:
使用transformers的Bertmodel时
问题代码:
model = Bertmodel.from_pretrained('bert_model')
问题原因:
下载的模型文件夹中没有pytorch_model.bin/tf_model.h5等文件,去原网址中查找也未发现相关文件。继而查看transformers官方使用说明:
from_pretrained
(pretrained_model_name_or_path, *model_args, **kwargs)文章来源:https://www.toymoban.com/news/detail-417493.html
-
pretrained_model_name_or_path – either: - a string with the shortcut name of a pre-trained model to load from cache or download, e.g.:
bert-base-uncased
. - a string with the identifier name of a pre-trained model that was user-uploaded to our S3, e.g.:dbmdz/bert-base-g
文章来源地址https://www.toymoban.com/news/detail-417493.html
到了这里,关于解决OSError: Error no file named pytorch_model.bin, tf_model.h5 found in directory的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!