I have a pretrained model for Image Colorization using captions. The model was trained using the image, a caption and the features extracted using ResNet101. I have that model saved as .pth.tar file. I want to predict the output for an image, how can I load that model and use it for prediction?
the common way would be this.
model = TheModelClass(*args, **kwargs) model.load_state_dict(torch.load(PATH)) model.eval()
here you can read more details:
Saving and Loading Models — PyTorch Tutorials 1.7.1 documentation