import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import torchvision
import torchvision.transforms as transforms
import numpy as np
from torch.utils.data.dataset import Dataset
ckpt_path=’/home/students/soumyajit_po/hsd_cnn_code/SOUMYA/checkpoint/vggCifar10TEST.pth’
checkpoint=torch.load(ckpt_path)
print(“Successfully Loaded”)
This code is giving me the following error:
Traceback (most recent call last):
File “Checking.py”, line 16, in 
checkpoint=torch.load(ckpt_path)
File “/home/anaconda2/envs/pytorch_v36/lib/python3.6/site-packages/torch/serialization.py”, line 387, in load
return _load(f, map_location, pickle_module, **pickle_load_args)
File “/home/anaconda2/envs/pytorch_v36/lib/python3.6/site-packages/torch/serialization.py”, line 574, in _load
result = unpickler.load()
AttributeError: Can’t get attribute ‘CifarVggnet’ on <module ‘main’ from ‘Checking.py’>
While Saving I did:
if(test_acc>best_accuracy):
best_accuracy=test_acc
print(‘Saving…’)
if not os.path.isdir(‘checkpoint’):
os.mkdir(‘checkpoint’)
torch.save(model,PATH)
Please tell me where I am going wrong as I am following the instruction given in https://pytorch.org/tutorials/beginner/saving_loading_models.html#saving-loading-a-general-checkpoint-for-inference-and-or-resuming-training 2