Since I cannot run your code, my best guess would be to try to lower the learning rate and play around a bit with other hyperparameters as well.
PS: I’ve formatted your code for better readability. You can add code snippets using three backticks ```