Skip to content

Commit

Permalink
Minor naming fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
johnml1135 committed Aug 14, 2024
1 parent cf58b8e commit 85138a5
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions machine/jobs/engine_build_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def run(
check_canceled()

logger.info("Pretranslating segments")
self.pretranslate_segments(progress_reporter, check_canceled)
self.batch_inference(progress_reporter, check_canceled)

self.save_model()
return self._train_corpus_size, self._confidence
Expand Down Expand Up @@ -68,7 +68,7 @@ def train_model(
) -> None: ...

@abstractmethod
def pretranslate_segments(
def batch_inference(
self,
progress_reporter: PhasedProgressReporter,
check_canceled: Optional[Callable[[], None]],
Expand Down
2 changes: 1 addition & 1 deletion machine/jobs/nmt_engine_build_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def train_model(
model_trainer.train(progress=phase_progress, check_canceled=check_canceled)
model_trainer.save()

def pretranslate_segments(
def batch_inference(
self,
progress_reporter: PhasedProgressReporter,
check_canceled: Optional[Callable[[], None]],
Expand Down
2 changes: 1 addition & 1 deletion machine/jobs/smt_engine_build_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def train_model(
if check_canceled is not None:
check_canceled()

def pretranslate_segments(
def batch_inference(
self,
progress_reporter: PhasedProgressReporter,
check_canceled: Optional[Callable[[], None]],
Expand Down
6 changes: 5 additions & 1 deletion machine/jobs/smt_model_factory.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from abc import ABC, abstractmethod
from pathlib import Path
from typing import Optional

from ..corpora.parallel_text_corpus import ParallelTextCorpus
from ..corpora.text_corpus import TextCorpus
Expand All @@ -25,7 +26,10 @@ def create_model_trainer(self, tokenizer: Tokenizer[str, int, str], corpus: Para

@abstractmethod
def create_engine(
self, tokenizer: Tokenizer[str, int, str], detokenizer: Detokenizer[str, str], truecaser: Truecaser
self,
tokenizer: Tokenizer[str, int, str],
detokenizer: Detokenizer[str, str],
truecaser: Optional[Truecaser] = None,
) -> TranslationEngine: ...

@abstractmethod
Expand Down
7 changes: 5 additions & 2 deletions machine/jobs/thot/thot_smt_model_factory.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import shutil
from pathlib import Path
from typing import Any
from typing import Any, Optional

from ...corpora.parallel_text_corpus import ParallelTextCorpus
from ...corpora.text_corpus import TextCorpus
Expand Down Expand Up @@ -67,7 +67,10 @@ def create_model_trainer(self, tokenizer: Tokenizer[str, int, str], corpus: Para
)

def create_engine(
self, tokenizer: Tokenizer[str, int, str], detokenizer: Detokenizer[str, str], truecaser: Truecaser
self,
tokenizer: Tokenizer[str, int, str],
detokenizer: Detokenizer[str, str],
truecaser: Optional[Truecaser] = None,
) -> TranslationEngine:
return ThotSmtModel(
word_alignment_model_type=self._config.thot.word_alignment_model_type,
Expand Down

0 comments on commit 85138a5

Please sign in to comment.