Skip to content

Instantly share code, notes, and snippets.

@ChunML
Last active April 30, 2019 09:38
Show Gist options
  • Save ChunML/02592b51de26f0d9dcdddc2adea90c66 to your computer and use it in GitHub Desktop.
Save ChunML/02592b51de26f0d9dcdddc2adea90c66 to your computer and use it in GitHub Desktop.
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