Error while loading the checkpoints

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

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.