kb2009:

But model.to(“cuda:0”) throws error that says “‘QuestionAnsweringModel’ object has no attribute ‘to’”. So I need to find a workaround for this.


I’m unsure how and if it was working before, but it seems you might be facing different issues and would have to debug what QuestionAnsweringModel is (it doesn’t seem to be an nn.Module) and how to push it to the device.
In any case, once to('cuda') is called on the model and input, the GPU will be used and you would see it in nvidia-smi (unless an error is raised of course).
A low GPU utilization could be caused by different bottlenecks in your code, e.g. the data loading, a lot of small kernel launches etc.