Some question while load the model

I have train.py which can train an model with data and save it as a pkl. Now, I load the pkl in another .py. However the model seems to be trained again while I load it.
Here is my code.

import torch
model = torch.load('a-b.pkl')

And it run the train.py again which means that I can’t get my the model I saved before.

You can do that. Sample example is given below -

        checkpoint = torch.load('a-b.pkl')
        opt.start_epoc = checkpoint['epoch']
        best_prec1 = checkpoint['best_prec1']
        model.load_state_dict(checkpoint['state_dict'])

For more details, you may check the following link: