By default, the model does not automatically save the weights of the best-
performing epoch. You need to explicitly configure this behavior using a
callback like modelcheckpoint in libraries like keras or TensorFlow.
I am attaching gist file for your reference