Hi can you try your code with the line:
optimizer=optim.SGD(model.fc.parameters(), lr=learning_rate)
The code seems totally legit and either this is the problem or one has to check the dataloader further.
There is also the probability of this
model.fc = new_fc_layers
assignment needs to be done differently.
For replacement check this out:
How to Replace a layer or Module in a pretrained network? - PyTorch Forums