You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After fine-tuning the model, it was saved successfully, however, when I tried loading it, it gave me this error as shown in the image below: ValueError: Layer 'pre_classifier' expected 0 variables, but received 2 variables during loading. Expected: []
I upgraded my environment to use Keras 3, but that didn't work. It is probably because I am using pretrained model from hugging face which uses keras 2 on the backend.
However, I found a way around it by saving the model in a .h5 file and then using the .load_weights function to load the model.
That works for me.
Hi,
I fine-tuned the following hugging face distilbert model for text classification.
After fine-tuning the model, it was saved successfully, however, when I tried loading it, it gave me this error as shown in the image below:
ValueError: Layer 'pre_classifier' expected 0 variables, but received 2 variables during loading. Expected: []
The Summary of the model looks like this:
What could have done wrong and how can I fix this issue so can load my model again?
The text was updated successfully, but these errors were encountered: