Closed turmeric-blend closed 4 years ago
Hello! That's because the user that uploaded that model didn't upload a TensorFlow version, only a PyTorch version. You can see it when you click on "show all files", you'll see that there is a pytorch_model.bin
, but no tf_model.h5
.
Here you can solve this by telling the TF model that you want to load from pytorch weights:
import tensorflow as tf
PRE_TRAINED_MODEL_NAME = 'ipuneetrathore/bert-base-cased-finetuned-finBERT'
model = TFBertForSequenceClassification.from_pretrained(PRE_TRAINED_MODEL_NAME, from_pt=True) # <-- here
and you could also ask the author (I believe @ipuneetrathore) if they could upload a TF version of the weights
hi @julien-c just wondering if there are any difference if the pytorch weights could be loaded through TF model anyway?
Just that the PyTorch weights will have to be converted on the fly every time you instantiate your TF model
đ Bug
Information
Model I am using (Bert, XLNet ...): TFBertModel
Language I am using the model on (English, Chinese ...): English
The problem arises when using:
The tasks I am working on is:
To reproduce
Steps to reproduce the behavior:
This Works:
This Does NOT Work:
Expected behavior
It should load the model.
Environment info
transformers
version: 3.0.0