When i’m using pytorch resnet model, model not converging,but when using other architecture model the training process work will.
configurations :
criterion = nn.CrossEntropyLoss()
optimizer = optim.SGD(net.parameters(), lr=0.001, momentum=0.9)
Resnet model
model_ft = models.resnet18(pretrained=True)
num_ftrs = model_ft.fc.in_features
model_ft.fc = nn.Linear(num_ftrs, 10)
net = model_ft


training steps:
[1,     4] loss: 526.469 acc: 348.250 
1393
[2,     4] loss: 529.261 acc: 346.750 
1387
[3,     4] loss: 532.855 acc: 349.250 
1397
[4,     4] loss: 530.508 acc: 348.000 
1392
[5,     4] loss: 526.442 acc: 347.000 
1388
[6,     4] loss: 531.521 acc: 348.500 
1394
[7,     4] loss: 527.574 acc: 348.250 
1393
[8,     4] loss: 527.463 acc: 349.000 
1396
[9,     4] loss: 527.096 acc: 347.250 
1389
[10,     4] loss: 529.270 acc: 348.750 
1395
[11,     4] loss: 527.993 acc: 348.500 
1394
[12,     4] loss: 532.372 acc: 349.000 
1396
[13,     4] loss: 530.069 acc: 348.250 
1393
[14,     4] loss: 531.173 acc: 348.000 
1392
[15,     4] loss: 530.445 acc: 347.250 
1389
Finished Training
type or paste code here

example for model that works well
class Net(nn.Module):
    def __init__(self):
        super(Net, self).__init__()
        self.conv1 = nn.Conv2d(3, 6, 5)
        self.pool = nn.MaxPool2d(2, 2)
        self.conv2 = nn.Conv2d(6, 16, 5)
        self.fc1 = nn.Linear(16 * 13 * 13, 120)
        self.fc2 = nn.Linear(120, 84)
        self.fc3 = nn.Linear(84, 10)

    def forward(self, x):
        x = self.pool(F.relu(self.conv1(x)))
        x = self.pool(F.relu(self.conv2(x)))
        x = x.view(-1, 16 * 13 * 13)
        x = F.relu(self.fc1(x))
        x = F.relu(self.fc2(x))
        x = self.fc3(x)
        return x

training steps:
[1,     4] loss: 578.536 acc: 355.250 
1421
[2,     4] loss: 432.506 acc: 438.250 
1753
[3,     4] loss: 359.835 acc: 503.250 
2013
[4,     4] loss: 289.072 acc: 544.250 
2177
[5,     4] loss: 251.283 acc: 568.500 
2274
[6,     4] loss: 237.213 acc: 575.750 
2303
[7,     4] loss: 207.391 acc: 590.250 
2361
[8,     4] loss: 192.430 acc: 598.500 
2394
[9,     4] loss: 178.400 acc: 605.250 
2421
[10,     4] loss: 172.829 acc: 609.500 
2438
[11,     4] loss: 150.899 acc: 617.000 
2468
[12,     4] loss: 160.563 acc: 614.750 
2459
[13,     4] loss: 139.884 acc: 623.750 
2495
[14,     4] loss: 124.817 acc: 629.000 
2516
[15,     4] loss: 132.767 acc: 626.000 
2504
Finished Training