Training Loss not improving so much

Epoch: 0 – Training Loss: 0.057411
Epoch: 1 – Training Loss: 0.056986
Epoch: 2 – Training Loss: 0.057286
Epoch: 3 – Training Loss: 0.057266

Anyone knows why it is sooo slow ??
My data set have 1248 images for training


model = models.densenet121(pretrained = True)

manter os features parameters

for param in model.parameters():
param.requires_grad = False
criterion = nn.NLLLoss()

optimizer = optim.Adam(model.parameters(), lr=0.003)

for e in range(epochs):
# keep track of training and validation loss
running_loss = 0.0
running_corrects = 0.0

for inputs, label in (dataloaders['train']):
    # IF GPU is availible
    if train_on_gpu:
        inputs, label = inputs.cuda(), label.cuda()
    with torch.set_grad_enabled(True):
        logps = model(inputs)
        _, preds = torch.max(logps, 1) # tecnica nova de validacao
        loss = criterion(logps, label)
        running_loss += loss.item()
        running_corrects += torch.sum(preds ==

I haven’t check but does densenet softmax already incorporated inside the model?

no , but this is not the problem here

Could you tell me why you are using this line?

Seems to me that setting the requires grad to False, prevents the optimizer from calculating gradients for the parameters and prevents any optimization from taking place.