Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
johnml1135 committed Sep 6, 2024
1 parent 998ee81 commit f625558
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion machine/jobs/build_nmt_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def clearml_progress(status: ProgressStatus) -> None:
raise RuntimeError("The model type is invalid.")

job = NmtEngineBuildJob(SETTINGS, nmt_model_factory, translation_file_service)
train_corpus_size = job.run(progress, check_canceled)
train_corpus_size, _ = job.run(progress, check_canceled)
if task is not None:
task.get_logger().report_single_value(name="train_corpus_size", value=train_corpus_size)
logger.info("Finished")
Expand Down
4 changes: 4 additions & 0 deletions machine/jobs/thot/thot_smt_model_factory.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import shutil
from typing import Optional

from ...corpora.parallel_text_corpus import ParallelTextCorpus
Expand All @@ -11,9 +12,12 @@
from ...translation.truecaser import Truecaser
from ...translation.unigram_truecaser import UnigramTruecaser, UnigramTruecaserTrainer
from ..smt_model_factory import SmtModelFactory
from . import _THOT_NEW_MODEL_DIRECTORY


class ThotSmtModelFactory(SmtModelFactory):
def init(self) -> None:
shutil.copytree(_THOT_NEW_MODEL_DIRECTORY, self._model_dir, dirs_exist_ok=True)

def create_model_trainer(self, tokenizer: Tokenizer[str, int, str], corpus: ParallelTextCorpus) -> Trainer:
return ThotSmtModelTrainer(
Expand Down
4 changes: 0 additions & 4 deletions machine/jobs/thot/thot_word_alignment_model_factory.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import shutil
from pathlib import Path

from ...corpora.parallel_text_corpus import ParallelTextCorpus
Expand All @@ -10,12 +9,9 @@
from ...translation.trainer import Trainer
from ...translation.word_alignment_model import WordAlignmentModel
from ..word_alignment_model_factory import WordAlignmentModelFactory
from . import _THOT_NEW_MODEL_DIRECTORY


class ThotWordAlignmentModelFactory(WordAlignmentModelFactory):
def init(self) -> None:
shutil.copytree(_THOT_NEW_MODEL_DIRECTORY, self._model_dir, dirs_exist_ok=True)

def create_model_trainer(self, tokenizer: Tokenizer[str, int, str], corpus: ParallelTextCorpus) -> Trainer:
(self._model_dir / "tm").mkdir(parents=True, exist_ok=True)
Expand Down

0 comments on commit f625558

Please sign in to comment.