We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 797bf75 commit 13d1b1aCopy full SHA for 13d1b1a
1 file changed
machine/translation/huggingface/hugging_face_nmt_engine.py
@@ -164,7 +164,9 @@ def _try_translate_n_batch(
164
builder = TranslationResultBuilder(input_tokens)
165
for token, score in zip(output["translation_tokens"], output["token_scores"]):
166
builder.append_token(token, TranslationSources.NMT, exp(score))
167
- builder.set_sequence_confidence(exp(output["sequence_score"]))
+ builder.set_sequence_confidence(
168
+ exp(output["sequence_score"]) if output["sequence_score"] is not None else -1
169
+ )
170
word_pairs: Optional[Collection[Union[AlignedWordPair, Tuple[int, int]]]] = None
171
if output.get("token_attentions") is not None:
172
src_indices = torch.argmax(output["token_attentions"], dim=1).tolist()
0 commit comments