1

I have one question, how to use the saved pre-trained model. For example, I have a model and I train it with the dataset I have and then I save it with the .pth extension. how to use file .pth to test new image. thanks

1 Answer 1

3

You can load the parameters inside from a.pt/h into a model like this:

# initialize a model with the same architecture as the model which parameters you saved into the .pt/h file model = Model() # load the parameters into the model model.load_state_dict(torch.load("parameters.pth")) 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.