Challenge with fine_tuning hugging face model

I’ve completed the specialization, however I saved the Hugging Face model which I’ve fine tuned with the provided dataset from question & answering model (2nd ungraded lab).
I noticed the line of code in bold doesn’t work

for question in questions:
inputs = tokenizer.encode_plus(question, text, return_tensors=“pt”)
#print(“inputs”, inputs)
#print(“inputs”, type(inputs))
input_ids = inputs[“input_ids”].tolist()[0]
inputs.to(“cuda”)

from my saved model, it’s always giving me the error show in the image, whereas during training & inference on the same sheet, i don’t encounter such error, Please I need assistance


I was able to resolve this by importing accelerator as I’ve initially installed this module. So I did
from accelerate import Accelerator

#i create an instance of the class
accelerator = Accelerator ()

#i then call the name of the device
device = “cuda”
device = accelerator.device
#then the solution
inputs.to(device)