Skip to content

Instantly share code, notes, and snippets.

@nihemak
Created December 5, 2016 12:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nihemak/718ce6aaaed40cf8493396f8f25589ed to your computer and use it in GitHub Desktop.
Save nihemak/718ce6aaaed40cf8493396f8f25589ed to your computer and use it in GitHub Desktop.
from Translator import Translator
import time
# 英日翻訳の学習
start_time = time.time()
print("model new start.")
model = Translator(True)
elapsed_time = time.time() - start_time
print("model new finished. elapsed_time: {0:.1f}[sec]".format(elapsed_time))
epoch_num = 100
for epoch in range(epoch_num):
start_time = time.time()
print("{0} / {1} epoch start.".format(epoch + 1, epoch_num))
# 学習を実施
model.learn(True)
modelfile = "en2ja-" + str(epoch) + ".model"
model.save_model(modelfile)
elapsed_time = time.time() - start_time
remaining_time = elapsed_time * (epoch_num - epoch - 1)
print("{0} / {1} epoch finished.".format(epoch + 1, epoch_num), end="")
print(" elapsed_time: {0:.1f}[sec]".format(elapsed_time), end="")
print(" remaining_time: {0:.1f}[sec]".format(remaining_time))
@nihemak
Copy link
Author

nihemak commented Dec 5, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment