OSError: Error no file named ['pytorch_model.bin', 'tf_model.h5', 'model.ckpt.index']

Viewed 5510

When I load the BERT pretrained model online I get this error 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 what should I do?

3 Answers

Here is what I found. Go to the following link, and click the circled to download, rename it to pytorch_model.bin, and drop it to the directory of biobert-nli, then the issue is resolved. Didn't figure out how to clone from the link.

https://huggingface.co/gsarti/biobert-nli/tree/main

enter image description here

These are the pretrained model files. You can download them from the repository, you have taken the code from if provided. If its HuggingFace you are using, you can get these on their site.

You can convert bert using transformers-cli (pip install transformers)

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
Related