Could you check, if your model gets valid gradients after the loss.backward() call via:
for name, param in model.named_parameters():
    print(name, param.grad)

If you see a None output it would mean that these parameters won’t be updated as no gradient is calculated for them and thus your computation graph might have been detached at one point.