From 217b671c4615f07d1e821984b8c8a836ce87b9b0 Mon Sep 17 00:00:00 2001 From: wasertech Date: Sat, 11 Mar 2023 19:03:19 +0100 Subject: [PATCH] v0.2.6b2 --- translator/__init__.py | 2 +- translator/main.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/translator/__init__.py b/translator/__init__.py index 659bdac..b2fa562 100644 --- a/translator/__init__.py +++ b/translator/__init__.py @@ -1,6 +1,6 @@ from translator.translate import Translator from translator.language import get_nllb_lang -__version__ = "0.2.5b2" +__version__ = "0.2.6b2" LANGS = get_nllb_lang() diff --git a/translator/main.py b/translator/main.py index 4a2e7d9..378f56b 100644 --- a/translator/main.py +++ b/translator/main.py @@ -1,5 +1,6 @@ import os, sys, psutil, time import locale +import datetime from multiprocessing import Queue, Process from threading import Thread @@ -154,7 +155,7 @@ def main(): time_before_3 = time.perf_counter() spinner.info("Translating untranslated sentences...") spinner.start() - spinner.text = f"[0/{_ut_ds:n} (0%) | 0 sentences / second]" + spinner.text = f"Processing first batch of {batch_size} sentences ({_ut_ds:n} total)... please wait for statistics." _i, _t = 0, 0 for batch in untranslated_dataset.iter(batch_size): @@ -165,7 +166,9 @@ def main(): time_meanwhile = time.perf_counter() _td = time_meanwhile - _t _i += batch_size - spinner.text = f"[{_i:n}/{_ut_ds:n} ({_i/_ut_ds:.2%}) | ~{batch_size/_td:.2f} sentences / second]" + _avg = batch_size/_td + _eta = (_ut_ds - _i) / _avg + spinner.text = f"[{_i:n}/{_ut_ds:n} ({_i/_ut_ds:.2%}) | ~{_avg:.2f} sentences / second | ETA : {datetime.timedelta(seconds=_eta)}]" time_after_3 = time.perf_counter() _td_3 = time_after_3 - time_before_3