flairNLP / flair

A very simple framework for state-of-the-art Natural Language Processing (NLP)
https://flairnlp.github.io/flair/
Other
13.7k stars 2.08k forks source link

[Bug]: Sequence tagger with CRF gives wrong probabilities for all classes #3469

Open petermartens1992 opened 3 weeks ago

petermartens1992 commented 3 weeks ago

Describe the bug

I have trained a sequence tagger with CRF and use the return_probabilities_for_all_classes flag when making the predictions.

The returned probabilities are wrong, ie the one selected label of the token is not the same as the label with the highest probability from the returned list.

This used to work fine in flair 0.10 but fails in 0.13.1

Also the probabilities for the spans are not available anymore via span.labels so currently I calculate them myself again from the tokens. Not sure if they are available in another way.

To Reproduce

-

Expected behavior

-

Logs and Stack traces

No response

Screenshots

No response

Additional Context

No response

Environment

flair 0.13.1

mauryaland commented 3 weeks ago

Will be fixed with this pull request https://github.com/flairNLP/flair/pull/3455

petermartens1992 commented 3 weeks ago

Hi @mauryaland, thanks for the pointer!

I patched it in my code base and can confirm it seems to work correctly now. Many thanks!

Any idea when it will be released as a new version?