-
Notifications
You must be signed in to change notification settings - Fork 27.9k
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 GPT2ForTokenClassification #13290
Add GPT2ForTokenClassification #13290
Conversation
Fixed all test failures and all passed. |
src/transformers/modeling_outputs.py
Outdated
@@ -449,6 +449,42 @@ class SequenceClassifierOutputWithPast(ModelOutput): | |||
attentions: Optional[Tuple[torch.FloatTensor]] = None | |||
|
|||
|
|||
@dataclass | |||
class TokenClassifierOutputWithPast(ModelOutput): |
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.
Think we can just reuse TokenClassifierOutput
no? Don't think it makes sense to use past
for token classification. Would one ever do more than one forward pass for token classification? If it's just one forward pass then I think we could force use_cache=False
in GPT2ForTokenClassification.
What do you think @tucan9389 ? :-)
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.
@patrickvonplaten
Thanks for your comment.
Oh, I agree with that. I'll change to TokenClassifierOutput
.
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.
Thanks a lot for adding this model!
@sgugger Thanks for approving. @patrickvonplaten I just fixed some errors that occurred in |
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.
Very nice! Thanks for you work here @tucan9389
What does this PR do?
GPT2ForTokenClassification
class for GPT2 upstream and NER downstream taskBefore submitting
Pull Request section?
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.
@patrickvonplaten, @LysandreJik
@sgugger, @patil-suraj