Thank you so much ptrblck for your reply.
After using this its giving error
checkpoint = torch.load(PATH)
model = CQCCModel()
optimizer = torch.optim.Adam(model.parameters(), lr=0.0001)
model.load_state_dict(checkpoint[‘model’])
error: model.load_state_dict(checkpoint[‘model’])
KeyError: ‘model’
If I am using “model.load_state_dict(checkpoint[model])” than its showing error
error:
KeyError: CQCCModel(
(layer1): Sequential(
(0): Conv2d(1, 32, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(1): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): LeakyReLU(negative_slope=0.03)
)
(layer2): Sequential(
(0): ResNetBlock(
(conv1): Conv2d(32, 32, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(bn1): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(lrelu): LeakyReLU(negative_slope=0.01)
(dropout): Dropout(p=0.5)
(conv2): Conv2d(32, 32, kernel_size=(3, 3), stride=(3, 3), padding=(1, 1))
(conv11): Conv2d(32, 32, kernel_size=(3, 3), stride=(3, 3), padding=(1, 1))
)
)
(layer3): Sequential(
(0): ResNetBlock(
(conv1): Conv2d(32, 32, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(bn1): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(lrelu): LeakyReLU(negative_slope=0.01)
(dropout): Dropout(p=0.5)
(conv2): Conv2d(32, 32, kernel_size=(3, 3), stride=(3, 3), padding=(1, 1))
(conv11): Conv2d(32, 32, kernel_size=(3, 3), stride=(3, 3), padding=(1, 1))
(pre_bn): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
(1): MaxPool2d(kernel_size=3, stride=3, padding=1, dilation=1, ceil_mode=False)
)
(layer4): Sequential(
(0): ResNetBlock(
(conv1): Conv2d(32, 32, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(bn1): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(lrelu): LeakyReLU(negative_slope=0.01)
(dropout): Dropout(p=0.5)
(conv2): Conv2d(32, 32, kernel_size=(3, 3), stride=(3, 3), padding=(1, 1))
(conv11): Conv2d(32, 32, kernel_size=(3, 3), stride=(3, 3), padding=(1, 1))
(pre_bn): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
(1): MaxPool2d(kernel_size=3, stride=3, padding=1, dilation=1, ceil_mode=False)
)
why this error is coming after defining the model (model = CQCCModel())?
Any suggestions is useful.
Thanks