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?
-
What solved it for me was upgrading to the latest version of the transformers library– nim.pyOct 3, 2023 at 12:07
Add a comment
|
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.
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
-
Need also "datasets" be already installed to extract "pytorch_model.bin" if not just enough to do it by pip "pip install datasets"– VahabJul 28, 2022 at 8:46