Predicting answers using DistilBertForQuestionAnswering

I have fine-tuned DistilBertForQuestionAnswering model using custom data. And I saved that model in colab. I can load the model as well.

I need to know how I can use that loaded model to input a question and get a answer(prediction).

You can find this info in the docs. Always nice to check docs before asking here :wink:

I tried the code in docs. But it gives me a error.

RuntimeError: Input, output and indices must be on the current device

I solved that issue by putting inputs.to(device)

It ran fine for one time. But then it gives the error “RuntimeError: CUDA error: device-side assert triggered”. And it is pointing to where I put “inputs.to(device)”.