I am using QuestionAnsweringModel from SimpleTransformers. When I run my code, and review my processes in Windows Task Manager, python is not using the GPU at all. I have included a code snippet to recreate the problem. Any help is highly appreciated.
import torch
from simpletransformers.question_answering
import QuestionAnsweringModel,QuestionAnsweringArgs
model_type=“bert”
model_name= “bert-base-cased”
model_args = QuestionAnsweringArgs()
train_args = {
'n_best_size':1 ,
‘overwrite_output_dir’: True,
‘show_running_loss’:True,
‘n_gpu’: 3
}
model = QuestionAnsweringModel(model_type,model_name, args=train_args, use_cuda=True)
I have also looked at a topic on the same issue here before. Recommendations were to update pytorch. But I have already done that as well.
Update: Tried to set the device to CUDA manually with the code below but no luck so far.
model.to(torch.device(“cuda:0” if torch.cuda.is_available() else “cpu”))
Thanks!