I want to have two separate programs, one that trains my model, saves the trained parameters, and the other to use those trained parameters to make predictions. I’ve tried placing:
torch.save(model, 'model_best.pt')
in one program. And in the testing program:
model = torch.load('model_best.pt')
Then I use the model to predict, e.g.:
output = model(x).
However, every time I call the torch.load, it seems to force me to retrain my model - it somehow calls my training program. Can anyone explain this behavior, and how you are supposed to properly do this?
Thanks