Hello
I have one .pth extension pytorch model this model works and predict correctly on web app but now i want to use and load this model on android app i know i have to convert this .pth extension model into torchvision for load model on android i have found code snippet and guide on pytorch guide to convert pretrained model into torchvision this is following code and its working correctly and convert pretrained mobile net model into torchvision but how to convert my .pth extension pytorch model into torchvision what changes i have to make in code i have tried to put my model path with model variable in following code but its not working.
import torch
import torchvision
model = torchvision.models.resnet18(pretrained=True)
model.eval()
example = torch.rand(1, 3, 224, 224)
traced_script_module = torch.jit.trace(model, example)
traced_script_module.save(“app/src/main/assets/model.pt”)