OpenNMT Forum

Translate_batch discrepancy

I am getting different results when passing two strings in a list, while passing them one by one:
[[‘▁когда’, ‘▁ри’, ‘ча’, ‘рд’, ‘▁’, ‘iii’, ‘▁погиб’, ‘▁,’, ‘▁а’, ‘▁на’, ‘▁тро’, ‘не’, ‘▁оказался’, ‘▁генри’, ‘х’, ‘▁’, ‘vii’, ‘▁тю’, ‘дор’, ‘▁,’, ‘▁этот’, ‘▁акт’, ‘▁был’, ‘▁отмен’, ‘ён’, ‘▁.’]]
translates to:
[[{‘tokens’: [‘▁ри’, ‘ч’, ‘ард’, ‘▁’, ‘’, ‘▁данԥсы’, ‘▁,’, ‘▁тро’, ‘а’, ‘да’, ‘▁,’, ‘▁генри’, ‘х’, ‘▁’, ‘’, ‘▁ати’, ‘уль’, ‘пан’, ‘ны’, ‘▁дҟалеит’, ‘▁,’, ‘▁уи’, ‘▁акт’, ‘▁ԥса’, ‘хын’, ‘▁.’], ‘score’: -21.878089904785156}]]
But when passed with another string in a list:
[[‘▁вскоре’, ‘▁после’, ‘▁смерти’, ‘▁её’, ‘▁отца’, ‘▁и’, ‘▁у’, ‘зу’, ‘р’, ‘па’, ‘ции’, ‘▁трона’, ‘▁ри’, ‘чар’, ‘дом’, ‘▁’, ‘iii’, ‘▁дети’, ‘▁эдуарда’, ‘▁’, ‘iv’, ‘▁от’, ‘▁елизаве’, ‘ты’, ‘▁ву’, ‘д’, ‘вил’, ‘л’, ‘▁были’, ‘▁объявлены’, ‘▁незаконно’, ‘ро’, ‘ждё’, ‘нными’, ‘▁.’], [‘▁когда’, ‘▁ри’, ‘ча’, ‘рд’, ‘▁’, ‘iii’, ‘▁погиб’, ‘▁,’, ‘▁а’, ‘▁на’, ‘▁тро’, ‘не’, ‘▁оказался’, ‘▁генри’, ‘х’, ‘▁’, ‘vii’, ‘▁тю’, ‘дор’, ‘▁,’, ‘▁этот’, ‘▁акт’, ‘▁был’, ‘▁отмен’, ‘ён’, ‘▁.’]]
Translates to:
[[{‘tokens’: [‘▁аԥсра’, ‘▁ашьҭахь’, ‘▁хара’, ‘▁имгакәа’, ‘▁иаб’, ‘▁,’, ‘▁ахылаԥшра’, ‘▁змоу’, ‘▁ри’, ‘ч’, ‘ард’, ‘▁’, ‘’, ‘▁@-@’, ‘▁тәи’, ‘▁ахәыҷқәа’, ‘▁,’, ‘▁елиза’, ‘вет’, ‘еи’, ‘▁в’, ‘уд’, ‘ар’, ‘ҵәыра’, ‘қәа’, ‘▁ир’, ‘шьит’, ‘▁;’], ‘score’: -37.87168884277344}], [{‘tokens’: [’’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’], ‘score’: nan}]]

Are you using the latest version?

Can you try setting the following environment variable:

MKL_CBWR=AUTO,STRICT

I had version ctranslate2 1.10.1, reinstalled to 1.13.2 and the problem was solved.

The translation became super fast, but it is giving a bit different translation:
[[{‘tokens’: [‘▁ри’, ‘ч’, ‘ард’, ‘▁’, ‘’, ‘▁данԥсы’, ‘▁,’, ‘▁тро’, ‘а’, ‘да’, ‘▁,’, ‘▁генри’, ‘х’, ‘▁’, ‘’, ‘▁ати’, ‘уль’, ‘пан’, ‘ны’, ‘▁дҟалеит’, ‘▁,’, ‘▁уи’, '▁акт’, ‘хеит’, ‘▁.’], ‘score’: -21.570240020751953}]]

I am not sure where I should set that variable?

Outputs may slightly change from version to version. But the overall translation quality should be unchanged.

If upgrading CTranslate2 solved your issue, then there is no need to set this variable.

For reference:

1 Like