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

**URL:** <https://discuss.huggingface.co/t/saved-fine-tuned-model-doesnt-work-after-loading-it/26283>\
**Category:** 🤗Transformers\
**Created:** [November 18, 2022, 12:05am UTC](https://discuss.huggingface.co/t/saved-fine-tuned-model-doesnt-work-after-loading-it/26283 "2022-11-18T00:05:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SergiiGurbych](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/sergiigurbych/32/12448_2.png) [@SergiiGurbych](https://discuss.huggingface.co/u/SergiiGurbych)\
**Post date:** [November 18, 2022, 12:05am UTC](https://discuss.huggingface.co/t/saved-fine-tuned-model-doesnt-work-after-loading-it/26283/1 "2022-11-18T00:05:48Z")

</div>

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 model.save(‘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?

---

<div class="post-metadata">

**Author:** ![nielsr](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nielsr/32/39617_2.png) [@nielsr](https://discuss.huggingface.co/u/nielsr)\
**Post date:** [November 18, 2022, 8:16am UTC](https://discuss.huggingface.co/t/saved-fine-tuned-model-doesnt-work-after-loading-it/26283/2 "2022-11-18T08:16:33Z")

</div>

Hi,

It’s recommended to use `save_pretrained` and `from_pretrained`

---

<div class="post-metadata">

**Author:** ![SergiiGurbych](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/sergiigurbych/32/12448_2.png) [@SergiiGurbych](https://discuss.huggingface.co/u/SergiiGurbych)\
**Post date:** [November 18, 2022, 6:57pm UTC](https://discuss.huggingface.co/t/saved-fine-tuned-model-doesnt-work-after-loading-it/26283/3 "2022-11-18T18:57:59Z")

</div>

Thank you!
