I got the work around for issue I was facing earlier.

model = Model.load(model_path, classes)
int_model = model.get_internal_model(model)
int_model.eval()
example = torch.rand(1, 3, 224, 224)
model_trace = torch.jit.trace(int_model, example)

but now m getting another error in the line

model_trace = torch.jit.trace(int_model, example)

RuntimeError: Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same
It seems my model is on GPU by the input is on CPU.
I have tried changing “example” to example.to(‘cuda’)
But then it says
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!
Any help regarding this ?