The grad_fn seems to be empty, so have you verified that the model parameters get valid gradients?
You could use this quick check after calling the backward() function:
for name, param in model.named_parameters():
    print(name, param.grad.abs().sum())