Skip to content

Instantly share code, notes, and snippets.

@esmitt
Last active October 15, 2020 20:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save esmitt/cc4a1342aa46131f8024c0d48c0a334d to your computer and use it in GitHub Desktop.
Save esmitt/cc4a1342aa46131f8024c0d48c0a334d to your computer and use it in GitHub Desktop.
Fit model function in Tensorflow 2
batch_size = 64
"""
Training the model for 60 epochs using our dataset.
The batch size (64) is the same for the validation data.
Only 1 callback was used, but could be more like TensorBoard, ModelCheckpoint, etc.
"""
history = model.fit(train_ds.batch(batch_size=batch_size),
epochs=60,
validation_data=validation_ds.batch(batch_size=batch_size),
callbacks=[early_callback])
model.save('model_base')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment