-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Better error messages for #62 #63
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @johnml1135)
machine/translation/huggingface/hugging_face_nmt_engine.py
line 52 at r1 (raw file):
raise ValueError( f"'{src_lang}' is not a valid language code. This error can happen when " + "there is no matching training data and the language code is not in the NLLB-200."
The error message is not appropriate in this context. It references "training data", which is specific to the workflow of a build job. It also references NLLB, but this class is not specific to NLLB. There are two options:
- Update the message here to give a little more detail, i.e.
The specified model does not support the language code '{src_lang}'.
or something similar. - Catch the error in
HuggingFaceNmtModelFactory
and throw a new exception with a more detailed message. In that case, we will need to raise a custom error here, so that we can avoid hiding otherValueError
instances.
I am in favor of the first option, since saying that "The specified model does not support the language code '{src_lang}'." is clearer terminology and implicitly directs the user to adjust the model to support the language code, rather than saying that a particular language code "is not valid" and having the user potentially think the issue is with the language code itself. |
Previously, ddaspit (Damien Daspit) wrote…
Option 1 is good enough. The error is being raised in production because of another issue that is being fixed now. |
Done. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #63 +/- ##
=======================================
Coverage 86.62% 86.62%
=======================================
Files 223 223
Lines 13376 13376
=======================================
Hits 11587 11587
Misses 1789 1789 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @johnml1135)
machine/translation/huggingface/hugging_face_nmt_engine.py
line 57 at r2 (raw file):
and tgt_lang not in additional_special_tokens ): raise ValueError(f"The specified model does not support the language code '{src_lang}'")
This should be {tgt_lang}
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @ddaspit)
machine/translation/huggingface/hugging_face_nmt_engine.py
line 57 at r2 (raw file):
Previously, ddaspit (Damien Daspit) wrote…
This should be
{tgt_lang}
.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @johnml1135)
This change is