-
Notifications
You must be signed in to change notification settings - Fork 885
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
Langid model gives languages not in langid_lang_subset on difficult strings #1076
Labels
Comments
I can see exactly where the problem is:
and then
maybe negative infinity instead of 0 for illegal languages would work better |
definitely not negative infinity considering that turns really unlikely languages into supa likely languages... |
AngledLuffa
added a commit
that referenced
this issue
Jul 13, 2022
… languages can be chosen if all legal languages were negative Addresses #1076
Thanks for pointing this out! |
AngledLuffa
added a commit
that referenced
this issue
Jul 14, 2022
… languages can be chosen if all legal languages were negative Addresses #1076
This is now fixed on 1.4.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
If you set a
lang_subset
to the langid processor, it gives as result a language that not always is in the subsetTo Reproduce
Steps to reproduce the behavior:
The result will be:
Expected behavior
The language should be
es
100% since I uselang_subset = ["es"]
Environment (please complete the following information):
Additional context
I see that here:
https://github.com/stanfordnlp/stanza/blob/011b6c4831a614439c599fd163a9b40b7c225566/stanza/models/langid/model.py#L85is used the
self.lang_subset
variable that should be["es"]
.While without this subset everything seems to work properly, if
self.lang_subset
is set not always.I tried to add some print
The result is:
I think in this case the string
aaa
was too difficult for the model (indeed it doesn't mean anything) and so the probability ofes
was-0.5372
(<0). All the other probability are set to-0.0000
that is an higher value. So when you compute the argmax you'll get the first label which is probablyla
.I know that this case can happen rarely, since with a real word the higher probability is usually positive, but I found some similar errors with models trained by me with your training script that sometimes take the first language of the label_list since the languages in the
lang_subset
have negative probabilities.The text was updated successfully, but these errors were encountered: