-
Notifications
You must be signed in to change notification settings - Fork 320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Translations differ #546
Comments
If you converted the model with quantization, then differences are expected. Without quantization, there is no guarantee that the translations are the same. In rare cases there could be small differences because the implementations are different. The difference (if any) can either improve or degrade the translation. |
I see... That's why it is combining words too? |
If there are differences, they could be of any types. Here it could be mean that an extra joiner was generated. Did you find other differences apart from this specific example? |
I also get different translation results between inferencing on GPU and CPU. |
Differences between CPU and GPU output is a different issue. Please open a separate issue if required. This is generally expected since the backends have non identical numerical outputs. |
I did some tests a while ago translating several test files with OpenNMT-py models and Ctranslate2 converted models. I recall obtaining same results in both cases. That's why I was surprised to see such cases where words are either repeated or joined. Joined words seem to come from different hypotheses. I just posted an example but I have some more examples in which similar joining issues happen. |
Are you able to share this model and a test case? If yes, I could take a deeper look and see why this is happening. |
I'm afraid I cannot share the model, sorry... |
To be sure, can you post the exact set of options you used to train this model? |
I used the default Transformer architecture options described in the docs: https://opennmt.net/OpenNMT-py/FAQ.html#how-do-i-use-the-transformer-model |
Hi @guillaumekln , We've been conducting some more tests to check where the source of the error was. We've found a strange behavior when translating with the server and using a Ctranslate2 model. As you mentioned, we can expect some differences in the translations returned by Ctranslate2 when compared to OpenNMT models. However, we surprisingly found that translations can differ even between requests depending on the number of sentences sent to the server. Translating the sentence in isolation results in the issue mentioned in this thread: Result Notice the However, when sending another sentence along with the previous one, it drastically changes the result:
In this case the sentence is correctly translated. |
Are you translating on CPU or GPU? |
on GPU |
Thanks for the additional observation. I was now able to reproduce a bug impacting the beam search. In some cases the incorrect word IDs were selected to build the final hypotheses. This explains the incorrect translations you are reporting. Thanks again. This is an important bug fix that I will release ASAP. |
Glad to hear that! |
I pushed version 2.5.1 with the fix. |
Thanks! |
Hi,
I've recently realized that my converted OpenNMT-py model is not returning the same translation for a sentence when compared to the original OpenNMT-py model. Model architecture is the default base Transformer. I'm using Ctranslate2 version 1.18.1.
It seems Ctranslate2 model is merging different hypotheses into the final result, thus, inserting some word repetitions and synonyms in the translation.
Example result:
OpenNMT-py: 2013ko abuztutik aurrera, ikertzaile txinatarren zenbait taldek instalazioetan egindako CRISPR bidezko lehen edizio arrakastatsuak dokumentatu zituzten.
Ctranslate2: 2013ko abuztutik aurrera, Txinako zenbait ikertzailbatzuek instalazioetan egindako CRISPR bidezko lehen edizio genetiko arrakastatsuak dokumentatu zituzten.
In the second case it should be either zenbait ikertzailek or ikertzaile batzuek, but it is combining both of them, even truncating some words.
This is the configuration file for the server:
Is this a known issue?
Thanks
The text was updated successfully, but these errors were encountered: