Thank you for your script. It works well. I was wondering what if the loss validation is decreasing very slightly over epochs ( ie delta validation loss < 1e-4 for instance).  Does the model stop learning in your case?