Save model each epoch

I want to save model for each epoch

but my training process is using;
not using for loop
the following is my code:, targets, optimizer, ctc_loss, batch_size, epoch=epochs), os.path.join(model_dir, ‘’))

any suggestion to save model for each epoch

thanks in advance

Did you define the fit method manually or are you using a higher-level API?
In the former case, you could just copy-paste the saving code into the fit function. In the latter case, I would assume that the library might provide some “on epoch end” - callbacks, which could be used to save the model.