Last active
April 30, 2019 09:38
-
-
Save ChunML/02592b51de26f0d9dcdddc2adea90c66 to your computer and use it in GitHub Desktop.
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
NUM_EPOCHS = 100 | |
start_time = time.time() | |
for e in range(NUM_EPOCHS): | |
for batch, (source_seq, target_seq_in, target_seq_out) in enumerate(dataset.take(-1)): | |
loss = train_step(source_seq, target_seq_in, | |
target_seq_out) | |
print('Epoch {} Loss {:.4f}'.format( | |
e + 1, loss.numpy())) | |
if (e + 1) % 10 == 0: | |
end_time = time.time() | |
print('Average elapsed time: {:.2f}s'.format((end_time - start_time) / (e + 1))) | |
try: | |
predict() | |
except Exception as e: | |
print(e) | |
continue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment