OSError: Error no file named ['pytorch_model.bin', 'tf_model.h5', 'model.ckpt.index']
OSError: Error no file named ['pytorch_model.bin', 'tf_model.h5', 'model.ckpt.index']
当我在线加载 BERT 预训练模型时出现此错误OSError: Error no file named ['pytorch_model.bin', 'tf_model.h5', 'model.ckpt.index'] found in directory uncased_L-12_H-768_A-12 or 'from_tf' set to False
我该怎么办?
这些是预训练模型文件。您可以从存储库下载它们,如果提供的话,您已经从中获取了代码。如果您正在使用它的 HuggingFace,您可以在他们的网站上获得这些。
这是我的发现。进入下面link,点击圈出的下载,重命名为pytorch_model.bin
,放到biobert-nli
目录下,问题解决。没有弄清楚如何从 link.
克隆
https://huggingface.co/gsarti/biobert-nli/tree/main
您可以使用 transformers-cli(pip 安装转换器)转换 bert
transformers-cli convert --model_type bert \
--tf_checkpoint $BERT_BASE_DIR/model.ckpt \
--config $BERT_BASE_DIR/config.json \
--pytorch_dump_output $BERT_BASE_DIR/pytorch_model.bin
当我在线加载 BERT 预训练模型时出现此错误OSError: Error no file named ['pytorch_model.bin', 'tf_model.h5', 'model.ckpt.index'] found in directory uncased_L-12_H-768_A-12 or 'from_tf' set to False
我该怎么办?
这些是预训练模型文件。您可以从存储库下载它们,如果提供的话,您已经从中获取了代码。如果您正在使用它的 HuggingFace,您可以在他们的网站上获得这些。
这是我的发现。进入下面link,点击圈出的下载,重命名为pytorch_model.bin
,放到biobert-nli
目录下,问题解决。没有弄清楚如何从 link.
https://huggingface.co/gsarti/biobert-nli/tree/main
您可以使用 transformers-cli(pip 安装转换器)转换 bert
transformers-cli convert --model_type bert \
--tf_checkpoint $BERT_BASE_DIR/model.ckpt \
--config $BERT_BASE_DIR/config.json \
--pytorch_dump_output $BERT_BASE_DIR/pytorch_model.bin