Created
April 30, 2019 04:02
-
-
Save ChunML/9b0b7ba9751faaa8718440498c91d97e 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
encoder = Encoder(en_vocab_size, MODEL_SIZE, NUM_LAYERS, H) | |
decoder = Decoder(fr_vocab_size, MODEL_SIZE, NUM_LAYERS, H) | |
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 % 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