Saved fine-tuned model doesn't work after loading it

Hi, guys!
I am fine-tuning a language model (“youscan/ukr-roberta-base”) and after fine-tuning it works properly and predicts perfectly. I save it with‘name’) to Google Colab and then move it to Google Drive. When I load it the next time with

model = tf.keras.models.load_model(‘./drive/MyDrive/place’)

and try to do the same .predict() as previously, I get error:

“ValueError: Exception encountered when calling layer” tf_roberta_for_sequence_classification_2" (type TFRobertaForSequenceClassification).
Could not find matching concrete function to call loaded from the SavedModel".

What is wrong here?


It’s recommended to use save_pretrained and from_pretrained

1 Like

Thank you!