# Error while loading the checkpoints

**URL:** <https://discuss.huggingface.co/t/error-while-loading-the-checkpoints/10644>\
**Category:** Models\
**Created:** [October 9, 2021, 2:52pm UTC](https://discuss.huggingface.co/t/error-while-loading-the-checkpoints/10644 "2021-10-09T14:52:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MuhammadRehman](https://avatars.discourse-cdn.com/v4/letter/m/e480ec/32.png) [@MuhammadRehman](https://discuss.huggingface.co/u/MuhammadRehman)\
**Post date:** [October 9, 2021, 2:52pm UTC](https://discuss.huggingface.co/t/error-while-loading-the-checkpoints/10644/1 "2021-10-09T14:52:28Z")

</div>

I finetuned the Xlm/roberta and got its .ckpt file. But I am unable to load these check points for testing. While loading, I am getting errors like this:  
‘XLMRobertaModel’ object has no attribute ‘load\_from\_checkpoint.’

I am using this code to load the checkpoint.

from transformers import AutoTokenizer  
model\_checkpoint = ‘deepset/xlm-roberta-base-squad2’  
tokenizer = AutoTokenizer.from\_pretrained(model\_checkpoint)

from transformers import AutoModelForQuestionAnswering  
model = AutoModelForQuestionAnswering.from\_pretrained(model\_checkpoint)

chk\_pth="/content/drive/MyDrive/Russian-QA/epoch=18-step=53826.ckpt"  
model2=model.load\_from\_checkpoint(chk\_pth)

kindly help me to sort out the slolution

---

<div class="post-metadata">

**Author:** ![sgugger](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/sgugger/32/2291_2.png) [@sgugger](https://discuss.huggingface.co/u/sgugger)\
**Post date:** [October 11, 2021, 2:17pm UTC](https://discuss.huggingface.co/t/error-while-loading-the-checkpoints/10644/2 "2021-10-11T14:17:05Z")

</div>

I’m not sure where you have seen the `load_from_checkpoint` method but it does not exist in Transformers. Same for the `.ckpt` file, it’s not something generated from our side.
