Skip to content

Translate: multiple-translations option is not working; incompatible with postprocessing options? #810

@mmartin9684-sil

Description

@mmartin9684-sil

If the --multiple-translations option is used on the experiment script, the translate step fails with an error about sequence_scores (see stack trace below).

The failure happens when the translate step is run with post-processing options, but also when it is run without.

A sample experiment with this error can be found in India\AdivasiOdia\NLLB.1.3B.te-TELUBSI.ort-OTT.

2025-08-20 12:09:43,153 - silnlp.nmt.translate - ERROR - Was not able to translate JON.
Traceback (most recent call last):
  File "/root/.clearml/venvs-builds/3.10/task_repository/silnlp.git/silnlp/nmt/translate.py", line 107, in translate_books
    translator.translate_book(
  File "/root/.clearml/venvs-builds/3.10/task_repository/silnlp.git/silnlp/common/translator.py", line 206, in translate_book
    self.translate_usfm(
  File "/root/.clearml/venvs-builds/3.10/task_repository/silnlp.git/silnlp/common/translator.py", line 276, in translate_usfm
    output = list(self.translate(sentences, src_iso, trg_iso, produce_multiple_translations, vrefs))
  File "/root/.clearml/venvs-builds/3.10/task_repository/silnlp.git/silnlp/nmt/hugging_face_config.py", line 1243, in translate
    for outputs in tqdm(
  File "/usr/local/lib/python3.10/dist-packages/tqdm/std.py", line 1181, in __iter__
    for obj in iterable:
  File "/root/.clearml/venvs-builds/3.10/task_repository/silnlp.git/silnlp/nmt/hugging_face_config.py", line 1474, in _translate_sentences
    yield from self._translate_sentence_helper(
  File "/root/.clearml/venvs-builds/3.10/task_repository/silnlp.git/silnlp/nmt/hugging_face_config.py", line 1524, in _translate_sentence_helper
    sampling_results: List[dict] = self._translate_with_sampling(
  File "/root/.clearml/venvs-builds/3.10/task_repository/silnlp.git/silnlp/nmt/hugging_face_config.py", line 1638, in _translate_with_sampling
    translations = pipeline(
  File "/usr/local/lib/python3.10/dist-packages/transformers/pipelines/text2text_generation.py", line 376, in __call__
    return super().__call__(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/transformers/pipelines/text2text_generation.py", line 167, in __call__
    result = super().__call__(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/transformers/pipelines/base.py", line 1283, in __call__
    outputs = list(final_iterator)
  File "/usr/local/lib/python3.10/dist-packages/transformers/pipelines/pt_utils.py", line 124, in __next__
    item = next(self.iterator)
  File "/usr/local/lib/python3.10/dist-packages/transformers/pipelines/pt_utils.py", line 125, in __next__
    processed = self.infer(item, **self.params)
  File "/usr/local/lib/python3.10/dist-packages/transformers/pipelines/base.py", line 1209, in forward
    model_outputs = self._forward(model_inputs, **forward_params)
  File "/root/.clearml/venvs-builds/3.10/task_repository/silnlp.git/silnlp/nmt/hugging_face_config.py", line 1916, in _forward
    sequences_scores = output.sequences_scores
AttributeError: 'GenerateEncoderDecoderOutput' object has no attribute 'sequences_scores'

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpipeline 6: inferIssue related to using a trained model to translate.

Type

Projects

Status

👀 In review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions