Skip to content

Instantly share code, notes, and snippets.

@edumunozsala
Created October 11, 2020 16:33
Show Gist options
  • Save edumunozsala/6644f17e15caed6e7ab1afb656e81031 to your computer and use it in GitHub Desktop.
Save edumunozsala/6644f17e15caed6e7ab1afb656e81031 to your computer and use it in GitHub Desktop.
Train and checkpoint the seq2seq model
# Create an Adam optimizer and clips gradients by norm
optimizer = tf.keras.optimizers.Adam(clipnorm=5.0)
# Create a checkpoint object to save the model
checkpoint_dir = './training_ckpt_seq2seq'
checkpoint_prefix = os.path.join(checkpoint_dir, "ckpt")
checkpoint = tf.train.Checkpoint(optimizer=optimizer,
encoder=encoder,
decoder=decoder)
losses, accuracies = main_train(encoder, decoder, dataset, EPOCHS, BATCH_SIZE, optimizer, checkpoint, checkpoint_prefix)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment