Fix the issue where `initial_epoch` for multi-worker fault tolerance purpose is assigned before it's loaded from checkpoint file.
Fix the issue where `initial_epoch` for multi-worker fault tolerance purpose is assigned before it's loaded from checkpoint file.

To recover from the epoch the previous training left at, Keras training loop needs two things to happen before entering the initial epoch: 1) Loading the model weights plus epoch information from the checkpoint, and 2) Update the `initial_epoch` variable within `model.fit()`. 1) has been configured to happen at `on_train_begin` of ModelCheckpoint callback, and 2) is done within `model.fit()`. During recent refactoring, 2) has been moved before 1) and thus we lost the epoch recovery, and this change swaps them back and fixes this issue.

PiperOrigin-RevId: 270766502

tensorflow/tensorflow-pywrap_saved_model,DavidNorman/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,davidzchen/tensorflow,gautam1858/tensorflow,adit-chandra/tensorflow,tensorflow/tensorflow,cxxgtxy/tensorflow,aam-at/tensorflow,DavidNorman/tensorflow,Intel-Corporation/tensorflow,cxxgtxy/tensorflow,petewarden/tensorflow,frreiss/tensorflow-fred,adit-chandra/tensorflow,gunan/tensorflow,jhseu/tensorflow,jhseu/tensorflow,davidzchen/tensorflow,jhseu/tensorflow,karllessard/tensorflow,frreiss/tensorflow-fred,DavidNorman/tensorflow,karllessard/tensorflow,jhseu/tensorflow,gunan/tensorflow,cxxgtxy/tensorflow,arborh/tensorflow,yongtang/tensorflow,petewarden/tensorflow,tensorflow/tensorflow,gunan/tensorflow,DavidNorman/tensorflow,xzturn/tensorflow,petewarden/tensorflow,Intel-tensorflow/tensorflow,ppwwyyxx/tensorflow,karllessard/tensorflow,aam-at/tensorflow,tensorflow/tensorflow,xzturn/tensorflow,yongtang/tensorflow,Intel-Corporation/tensorflow,renyi533/tensorflow,Intel-tensorflow/tensorflow,ppwwyyxx/tensorflow,paolodedios/tensorflow,jhseu/tensorflow,davidzchen/tensorflow,gunan/tensorflow,renyi533/tensorflow,sarvex/tensorflow,davidzchen/tensorflow,cxxgtxy/tensorflow,frreiss/tensorflow-fred,tensorflow/tensorflow,aam-at/tensorflow,tensorflow/tensorflow-pywrap_saved_model,gautam1858/tensorflow,yongtang/tensorflow,tensorflow/tensorflow-pywrap_saved_model,DavidNorman/tensorflow,sarvex/tensorflow,annarev/tensorflow,karllessard/tensorflow,tensorflow/tensorflow-pywrap_saved_model,aldian/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,freedomtan/tensorflow,tensorflow/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,paolodedios/tensorflow,xzturn/tensorflow,freedomtan/tensorflow,jhseu/tensorflow,ppwwyyxx/tensorflow,Intel-tensorflow/tensorflow,petewarden/tensorflow,tensorflow/tensorflow-pywrap_saved_model,paolodedios/tensorflow,DavidNorman/tensorflow,jhseu/tensorflow,ppwwyyxx/tensorflow,aam-at/tensorflow,jhseu/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,Intel-tensorflow/tensorflow,aam-at/tensorflow,cxxgtxy/tensorflow,xzturn/tensorflow,Intel-tensorflow/tensorflow,adit-chandra/tensorflow,paolodedios/tensorflow,arborh/tensorflow,gautam1858/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,annarev/tensorflow,yongtang/tensorflow,tensorflow/tensorflow,davidzchen/tensorflow,yongtang/tensorflow,annarev/tensorflow,arborh/tensorflow,karllessard/tensorflow,gunan/tensorflow,xzturn/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,renyi533/tensorflow,aldian/tensorflow,adit-chandra/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,aldian/tensorflow,aam-at/tensorflow,adit-chandra/tensorflow,petewarden/tensorflow,Intel-tensorflow/tensorflow,aam-at/tensorflow,frreiss/tensorflow-fred,aam-at/tensorflow,frreiss/tensorflow-fred,Intel-Corporation/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,gautam1858/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,freedomtan/tensorflow,aldian/tensorflow,ppwwyyxx/tensorflow,renyi533/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,freedomtan/tensorflow,jhseu/tensorflow,xzturn/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow,davidzchen/tensorflow,Intel-Corporation/tensorflow,sarvex/tensorflow,gunan/tensorflow,davidzchen/tensorflow,tensorflow/tensorflow-pywrap_saved_model,davidzchen/tensorflow,jhseu/tensorflow,Intel-tensorflow/tensorflow,annarev/tensorflow,aldian/tensorflow,DavidNorman/tensorflow,Intel-tensorflow/tensorflow,paolodedios/tensorflow,sarvex/tensorflow,sarvex/tensorflow,annarev/tensorflow,tensorflow/tensorflow,petewarden/tensorflow,xzturn/tensorflow,frreiss/tensorflow-fred,xzturn/tensorflow,gunan/tensorflow,DavidNorman/tensorflow,paolodedios/tensorflow,renyi533/tensorflow,Intel-Corporation/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,renyi533/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,gautam1858/tensorflow,petewarden/tensorflow,annarev/tensorflow,petewarden/tensorflow,frreiss/tensorflow-fred,karllessard/tensorflow,xzturn/tensorflow,gunan/tensorflow,aldian/tensorflow,arborh/tensorflow,tensorflow/tensorflow-pywrap_saved_model,arborh/tensorflow,petewarden/tensorflow,gautam1858/tensorflow,gunan/tensorflow,xzturn/tensorflow,renyi533/tensorflow,karllessard/tensorflow,ppwwyyxx/tensorflow,cxxgtxy/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,annarev/tensorflow,xzturn/tensorflow,arborh/tensorflow,gautam1858/tensorflow,tensorflow/tensorflow-pywrap_saved_model,cxxgtxy/tensorflow,renyi533/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,gunan/tensorflow,tensorflow/tensorflow,sarvex/tensorflow,yongtang/tensorflow,freedomtan/tensorflow,gunan/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,Intel-Corporation/tensorflow,ppwwyyxx/tensorflow,freedomtan/tensorflow,tensorflow/tensorflow-pywrap_saved_model,Intel-Corporation/tensorflow,arborh/tensorflow,gautam1858/tensorflow,karllessard/tensorflow,paolodedios/tensorflow,freedomtan/tensorflow,ppwwyyxx/tensorflow,petewarden/tensorflow,Intel-Corporation/tensorflow,DavidNorman/tensorflow,davidzchen/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,ppwwyyxx/tensorflow,Intel-tensorflow/tensorflow,ppwwyyxx/tensorflow,ppwwyyxx/tensorflow,arborh/tensorflow,freedomtan/tensorflow,Intel-tensorflow/tensorflow,annarev/tensorflow,yongtang/tensorflow,gautam1858/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,cxxgtxy/tensorflow,renyi533/tensorflow,tensorflow/tensorflow-pywrap_saved_model,DavidNorman/tensorflow,davidzchen/tensorflow,adit-chandra/tensorflow,adit-chandra/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,adit-chandra/tensorflow,tensorflow/tensorflow-pywrap_saved_model,yongtang/tensorflow,aam-at/tensorflow,annarev/tensorflow,davidzchen/tensorflow,yongtang/tensorflow,arborh/tensorflow,karllessard/tensorflow,paolodedios/tensorflow,aldian/tensorflow,frreiss/tensorflow-fred,jhseu/tensorflow,yongtang/tensorflow,gautam1858/tensorflow,frreiss/tensorflow-fred,petewarden/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,xzturn/tensorflow,annarev/tensorflow,gautam1858/tensorflow,karllessard/tensorflow,frreiss/tensorflow-fred,frreiss/tensorflow-fred,Intel-tensorflow/tensorflow,adit-chandra/tensorflow,freedomtan/tensorflow,petewarden/tensorflow,ppwwyyxx/tensorflow,renyi533/tensorflow,jhseu/tensorflow,adit-chandra/tensorflow,adit-chandra/tensorflow,arborh/tensorflow,aam-at/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,frreiss/tensorflow-fred,freedomtan/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,sarvex/tensorflow,aam-at/tensorflow,paolodedios/tensorflow,yongtang/tensorflow,freedomtan/tensorflow,aldian/tensorflow,tensorflow/tensorflow,renyi533/tensorflow,adit-chandra/tensorflow,davidzchen/tensorflow,aam-at/tensorflow,gunan/tensorflow,freedomtan/tensorflow,arborh/tensorflow,tensorflow/tensorflow,DavidNorman/tensorflow,DavidNorman/tensorflow,gautam1858/tensorflow,annarev/tensorflow,renyi533/tensorflow,arborh/tensorflow,sarvex/tensorflow,karllessard/tensorflow