Here is an example of fit_generator(): model.fit_generator(generator(features, labels, batch_size), samples_per_epoch=50, nb_epoch=10)Breaking it down: generator(features, labels, batch_size): generates batches of samples indefinitely sample_per_epoch: number of samples you want to train in each epoch nb_epoch: number of epochs As you can manually define sample_per_epoch and nb_epoch , you have to