Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
4b4bba0
Use native eflomal implementation
Enkidu93 Jul 21, 2026
718b067
Remove redundant alignment score
Enkidu93 Jul 21, 2026
a65e946
Fix api usage; adjust test
Enkidu93 Jul 22, 2026
a87817c
Remove unused import
Enkidu93 Jul 22, 2026
c211c6e
Properly mock word alignment; revert settings
Enkidu93 Jul 22, 2026
883f37d
Fix logging; do not include NULL alignments
Enkidu93 Jul 23, 2026
d1cd61d
Make naming more consistent
Enkidu93 Jul 23, 2026
7e96370
Revert settings.yml change
Enkidu93 Jul 23, 2026
dc5fba1
Use transductive API for getting alignments
ddaspit Jul 24, 2026
586deda
Update word alignment build job to properly use alignment API and batch
Enkidu93 Jul 29, 2026
8257dc4
Address reviewer comments
Enkidu93 Aug 10, 2026
f512b49
Update word alignment job test mock to return correct type
Enkidu93 Aug 10, 2026
9ccbf07
Add logging for debugging
Enkidu93 Aug 12, 2026
4f7ef98
Revert debugging changes
Enkidu93 Aug 12, 2026
b247d13
Debug commit
Enkidu93 Aug 19, 2026
6599e83
Update thot; report steps (debug)
Enkidu93 Aug 20, 2026
963ee7c
Debug steps and reporting
Enkidu93 Aug 20, 2026
01ddc0e
Remove debug logging; add proper align phase
Enkidu93 Aug 20, 2026
41a5f2b
Debug logging
Enkidu93 Aug 20, 2026
7946322
Fix update frequency setting
Enkidu93 Aug 20, 2026
ab22a84
Remove debug logging; make update frequency dynamic
Enkidu93 Aug 20, 2026
0a98932
Remove reporting (debug commit)
Enkidu93 Aug 20, 2026
33c5844
Fix typo (debug)
Enkidu93 Aug 20, 2026
a4f1cf2
Remove debug changes; add comment
Enkidu93 Aug 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion machine/corpora/aligned_word_pair.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def format_score(score: float) -> str:
source_index = "NULL" if self.source_index < 0 else str(self.source_index)
target_index = "NULL" if self.target_index < 0 else str(self.target_index)
repr = f"{source_index}-{target_index}"
if include_scores and self.translation_score >= 0:
if include_scores and (self.translation_score >= 0 or self.alignment_score >= 0):
repr += f":{format_score(self.translation_score)}"
if self.alignment_score >= 0:
repr += f":{format_score(self.alignment_score)}"
Expand Down
1 change: 1 addition & 0 deletions machine/corpora/corpora_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def alignment_exception(refs: Iterable[str]) -> RuntimeError:
def batch(iterable: Iterable[T], batch_size: int) -> Iterable[Sequence[T]]:
if isinstance(iterable, Sequence) and len(iterable) <= batch_size:
yield iterable
return

batch: List[T] = []
for item in iterable:
Expand Down
15 changes: 7 additions & 8 deletions machine/corpora/flatten.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,13 @@ def flatten(corpora: Iterable[Corpus]) -> Corpus:
if len(corpus_list) == 1:
return corpus_list[0]

if any(type(corpus_list[0]) != type(corpus) for corpus in corpus_list[1:]): # noqa: E721
raise TypeError("All corpora must be of the same type.")

if isinstance(corpus_list[0], TextCorpus):
if all(isinstance(corpus, TextCorpus) for corpus in corpus_list):
return _FlattenTextCorpus(cast(List[TextCorpus], corpus_list))
if isinstance(corpus_list[0], AlignmentCorpus):
if all(isinstance(corpus, AlignmentCorpus) for corpus in corpus_list):
return _FlattenAlignmentCorpus(cast(List[AlignmentCorpus], corpus_list))
return _FlattenParallelTextCorpus(cast(List[ParallelTextCorpus], corpus_list))
if all(isinstance(corpus, ParallelTextCorpus) for corpus in corpus_list):
return _FlattenParallelTextCorpus(cast(List[ParallelTextCorpus], corpus_list))
raise TypeError("All corpora must be of the same type.")


class _FlattenTextCorpus(TextCorpus):
Expand Down Expand Up @@ -100,7 +99,7 @@ def is_target_tokenized(self) -> bool:
def count(self, include_empty: bool = True, text_ids: Optional[Iterable[str]] = None) -> int:
return sum(c.count(include_empty, text_ids) for c in self._corpora)

def _get_rows(self) -> Generator[ParallelTextRow, None, None]:
def _get_rows(self, text_ids: Optional[Iterable[str]] = None) -> Generator[ParallelTextRow, None, None]:
for corpus in self._corpora:
with corpus.get_rows() as rows:
with corpus.get_rows(text_ids) as rows:
yield from rows
5 changes: 4 additions & 1 deletion machine/jobs/build_nmt_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from .nmt_engine_build_job import NmtEngineBuildJob
from .nmt_model_factory import NmtModelFactory
from .shared_file_service_factory import SharedFileServiceType
from .thot.thot_word_alignment_model_factory import ThotWordAlignmentModelFactory
from .translation_file_service import TranslationFileService

# Setup logging
Expand Down Expand Up @@ -57,7 +58,9 @@ def clearml_progress(status: ProgressStatus) -> None:
else:
raise RuntimeError("The model type is invalid.")

job = NmtEngineBuildJob(SETTINGS, nmt_model_factory, translation_file_service)
job = NmtEngineBuildJob(
SETTINGS, nmt_model_factory, translation_file_service, ThotWordAlignmentModelFactory(SETTINGS)
)
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)
Expand Down
167 changes: 0 additions & 167 deletions machine/jobs/eflomal_aligner.py

This file was deleted.

Loading