# Reloading a saved fine-tuned model trained using the Trainer Object from Huggingface does not yield correct predictions

**URL:** <https://discuss.huggingface.co/t/reloading-a-saved-fine-tuned-model-trained-using-the-trainer-object-from-huggingface-does-not-yield-correct-predictions/15723>\
**Category:** Beginners\
**Created:** [March 15, 2022, 1:01pm UTC](https://discuss.huggingface.co/t/reloading-a-saved-fine-tuned-model-trained-using-the-trainer-object-from-huggingface-does-not-yield-correct-predictions/15723 "2022-03-15T13:01:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nlp-programmer](https://avatars.discourse-cdn.com/v4/letter/n/a4c791/32.png) [@nlp-programmer](https://discuss.huggingface.co/u/nlp-programmer)\
**Post date:** [March 15, 2022, 1:01pm UTC](https://discuss.huggingface.co/t/reloading-a-saved-fine-tuned-model-trained-using-the-trainer-object-from-huggingface-does-not-yield-correct-predictions/15723/1 "2022-03-15T13:01:35Z")

</div>

I am trying to load a saved fine-tuned model that has been saved locally in my Google drive. I performed sentiment analysis using Roberta model and saved the model. The model was also predicting correctly with utmost accuracy using the Trainer object, but when I loaded the saved model, it only predicts ‘0’ for negative sentiments. My conclusion is that the model is not being retrieved efficiently.

```auto
from transformers import RobertaForSequenceClassification,RobertaTokenizer 
model = RobertaForSequenceClassification.from_pretrained("/content/drive/MyDrive/senti-model", local_files_only=True)
tokenizer=RobertaTokenizer.from_pretrained("/content/drive/MyDrive/senti-model")

from transformers import pipeline 
classifier = pipeline("sentiment-analysis",model=model,tokenizer=tokenizer) predicted_output_from_model=classifier(val_texts)
print(predicted_output_from_model)

```

[{‘label’: ‘NEGATIVE’, ‘score’: 0.5003366470336914}, {‘label’: ‘NEGATIVE’, ‘score’: 0.5003368854522705}, {‘label’: ‘NEGATIVE’, ‘score’: 0.5003371834754944}, {‘label’: ‘NEGATIVE’, ‘score’: 0.500337541103363}, {‘label’: ‘NEGATIVE’, ‘score’: 0.5003368854522705}, {‘label’: ‘NEGATIVE’, ‘score’: 0.5003374814987183}, {‘label’: ‘NEGATIVE’, ‘score’: 0.5003378987312317}, {‘label’: ‘NEGATIVE’, ‘score’: 0.5003373026847839}, {‘label’: ‘NEGATIVE’, ‘score’: 0.5003367066383362}, {‘label’: ‘NEGATIVE’, ‘score’: 0.5003374218940735}]

The same label and score get predicted for all the texts. I checked to see if my validation texts are all different, and they are. I have these files in my senti-model: config.json, pytorch\_model.bin, special\_tokens\_map.json, tokenizer\_config.json, training\_args.bin, vocab.json. Thanks
