Created
October 11, 2020 16:33
-
-
Save edumunozsala/6644f17e15caed6e7ab1afb656e81031 to your computer and use it in GitHub Desktop.
Train and checkpoint the seq2seq model
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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