-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
add prediction label type for span classifier #3432
Conversation
0408e72
to
c817b63
Compare
c817b63
to
2bab651
Compare
2bab651
to
90480b2
Compare
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.
This currently does not work. To reproduce:
from flair.data import Sentence
from flair.models import MultitaskModel
# For comparison: This works since the label type is "ner" for both models in the multitask model
classifier: MultitaskModel = MultitaskModel.load("zelda")
sentence = Sentence("Kirk and Spock met on the Enterprise")
classifier.predict(sentence)
print(sentence)
# Giving them sensible label names, now made possible with this PR
classifier.tasks["Task_1"]._label_type = "nel"
classifier.tasks["Task_1"]._span_label_type = "ner"
# However, this no longer makes predictions
sentence = Sentence("Kirk and Spock met on the Enterprise")
classifier.predict(sentence)
print(sentence)
The problem lies in the _filter_data_point
method of the DefaultClassifier
.
@helpmefindaname I've pushed a small fix for the issue. I'll approve now, but can you double beck before you merge? |
c4833f4
to
1447745
Compare
@alanakbik good catch, I did a small change so we allow both, setting the |
Thanks @helpmefindaname! |
No description provided.