解决OSError: Error no file named pytorch
•
人工智能
问题:
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)
-
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://net2asp.com/6177de8ce6.html
