Loading Custom .pth model (mobilenet) and Inference

Hi :raised_hand_with_fingers_splayed:
I have Trained SSD-Mobilenet Object Detection model with this [pytorch-ssd] repository on GitHub and get mobilenet_checkpoint.pth model file
now I want to convert it to a .pt file and Inference…
how can I do that?
I try a lot of methods and don’t get an answer…
another thing I want to convert the model to onnx
when I Try to convert the .pth model to onnx with that repository it gives me an error…

Hi!

I think this example (not for tour model, but similar) can help you

import torch
import torchvision
from unet import UNet 

model = UNet(3, 2)
model.load_state_dict(torch.load("best_weights.pth"))
model.eval()
example = torch.rand(1, 3, 320, 480)
traced_script_module = torch.jit.trace(model, example)
traced_script_module.save("model.pt")

Here example is the tensor that has the same dimension as your data