-
Notifications
You must be signed in to change notification settings - Fork 3k
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
The translation of the model Helsinki-NLP/opus-mt-es-en in onnx is poor. #17677
Comments
Did you try running the original model to see if the translation is different? It'll be good to pinpoint if this is a model issue, conversion to onnx issue, or onnxruntime issue. |
Hi @faxu , thank for your suggestion. Yes, I run this program:
The output is good: |
I am not sure if the mapping from
to
is correct. The first token generated by onnxruntime matches the first token generated by huggingface, so the computation for the first token (i.e., the whole model's computation) seems correct in onnxruntime. It makes feel there could be bug in the sequence-generating part. I can take a look at the |
@wschin "If you use the same for-loop to feed data token-by-token into huggingface model, does it generate text similar to onnxruntime's output?" I haven't tried it, I don't know how to do it into hugging face model :(. From what I have investigated, the way to export with
I did a program using the same logic with encoder and decoder: However, I also got a wrong translation. Seems there is a problem currently with Marian models on hugging face. |
Since it doesn't sound onnxruntime bug, I will close this for now. Feel free to reopen if huggingface thinks ORT has problems. Thank you! |
Describe the issue
I have exported to onnx the Marian model to translate spanish to english (Helsinki-NLP/opus-mt-es-en). After, a program in python to apply the translation with onnxruntime. However, the translation is not very good, for example:
Input in spanish:
"La novela Crimen y castigo está dividida en seis partes más el epílogo. Mucho se ha comentado de la noción de dualismo en la obra, sugiriéndose la existencia de cierto grado de simetría en ella. Los episodios clave se distribuyen primero en una mitad y luego de nuevo en la otra."
Output in english:
The The Crime and Punishment novel is divided into six parts more the epi. has been commented on the notion dual in, suggesting the existence of a degree of sym in. Key episodes are first distributed in one half and again in the in....
As I said, the translation is poor. I was wondering if there is any way to improve the translation?
To reproduce
I exported the opus-mt-es-en model with this command:
python -m transformers.onnx --model=Helsinki-NLP/opus-mt-es-en --feature=seq2seq-lm --atol=1e-04 D:\\Marian
The python program to do the translation from spahish to english is this:
Urgency
No response
Platform
Windows
OS Version
Windows 10 64 bits
ONNX Runtime Installation
Released Package
ONNX Runtime Version or Commit ID
1.15.1
ONNX Runtime API
Python
Architecture
X64
Execution Provider
Default CPU
Execution Provider Library Version
No response
The text was updated successfully, but these errors were encountered: