From skimming your code, it looks like you are not zeroing out the gradients after the weight update.
In this case the gradients get accumulated and the weight updates will be quite useless.
Add this line into your for loop and run it again:
self.optimizer.zero_grad()

It is also recommended to call the model directly to compute the forward pass instead of model.forward().
If you use model.forward() the hooks won’t be called, which might be unimportant in your current code, but might lead to errors in the future. 
Also, you could update to the latest stable release (0.4.0). You can find the install instructions on the website 1.