This can come from many things.
Have you verified that the values are correct at the first iteration?
Have you tried with a very low learning rate? models that diverge usually lead to nans after a while.
You can try and remove the warnings above as well for better readability.