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:

  
      gist.github.com
  
  
    https://gist.github.com/avijit9/1c7eebf124a02a555f7626a0fbcd04a5 17
finetune.py
from __future__ import print_function
import argparse
import os
import time
import pdb
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "3"
import random
import torch
import torch.nn as nn
This file has been truncated. show original