Fionetune model always predicts same output class for new data
I have a problem, trained a model with bert which give around 0.90% on test data and I decide to use it on new data which were not annotated. When running the model, I keep getting the same class output. And I would like to know why ?Can you help me ?
2021-12-25T14:12:01Z
Hey! Just wanted to state that I am facing the same problem and still don’t know how this is happening. I was working with RoBERTaForSequenceClassification with a binary classification problem and it gave 50% ACC. after 5 epochs. It did not learn anything at all.
2021-12-25T15:33:56Z
Hey@emmakelo, it may be a dataset imbalance. Accuracy is generally not a good metric, check the precision and recall values.
2021-12-30T08:53:05Z
Thank you!! I solve the problem. Actually I was not loading correctly the model after training, do not know why ? Now the problem is corrected.
2022-08-17T10:55:27Z
What was the issue when loading it? I think I’m having the same problem. I get exactly the same output from the model no matter what I give it as input.loaded_model = AutoModelForSequenceClassification.from_pretrained("custom_model")
tokenizer = AutoTokenizer.from_pretrained("roberta-base")
predict_input = tokenizer("Hello world", truncation=True, padding=True, return_tensors="pt")
predictions = model(**predict_input)
2022-08-29T11:58:10Z
I think you need to set a seed before initialising the model.
2024-04-04T20:19:29Z
I tried setting a seed and it worked for a bit, and then it went back to outputting the same thing. Any advice?
2024-06-19T11:29:30Z
Hi, I also have the same problem. I am using Protbert model for protein sequence classification. While training it produces different logits for each train sequences. but for model.eval(), it produces the same logits for each of the sequences in the validation dataset? The same issue for the protT5 model from the huggingface.