12

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?

1
  • What solved it for me was upgrading to the latest version of the transformers library
    – nim.py
    Oct 3, 2023 at 12:07

3 Answers 3

7

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

2

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.

1

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
1
  • Need also "datasets" be already installed to extract "pytorch_model.bin" if not just enough to do it by pip "pip install datasets"
    – Vahab
    Jul 28, 2022 at 8:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.