added functionality for electra classification head#4257
Merged
LysandreJik merged 4 commits intohuggingface:masterfrom May 22, 2020
Merged
added functionality for electra classification head#4257LysandreJik merged 4 commits intohuggingface:masterfrom
LysandreJik merged 4 commits intohuggingface:masterfrom
Conversation
Member
|
This is great, thanks @liuzzi! We would need to add the corresponding tests. Can you do it, or would you like me to do it? If so, may I push directly on your fork? |
Contributor
Author
|
@LysandreJik sure! i just invited you to collaborate. I haven't been inside the transformers testing code so it'd probably be much faster for you to do. Let me know if you have any questions/if i can help. |
Member
|
I just pushed the tests on it, thanks for your contribution! |
LysandreJik
approved these changes
May 11, 2020
29db302 to
6d02ff3
Compare
Member
|
Pushed a style change, rebased and merged into master. Thanks @liuzzi ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added functionality for an electra classification head following the google repo.
Tested and trains fine with the run_glue script. I was testing on my own repurposed classification problems so i didnt evaluate the actual GLUE accuracies, but can confirm that it is getting competitive results on my own problems.
Saw a few requests for this, thought it could benefit the community.
Originally I used a tanh activation in the classification head. (which in my tests reliably performed better than a gelu activation) But looking over the google code, it seems that they used gelu, so to keep the integrity of their paper im committing gelu here.
I also opted to make a ClassificationHead class instead of integrating a pooling layer in the base model class because i wasn't sure if that would affect other things, or run time in non sequence-classification tasks.