Skip to content

added functionality for electra classification head#4257

Merged
LysandreJik merged 4 commits intohuggingface:masterfrom
liuzzi:electra-sequence-classification
May 22, 2020
Merged

added functionality for electra classification head#4257
LysandreJik merged 4 commits intohuggingface:masterfrom
liuzzi:electra-sequence-classification

Conversation

@liuzzi
Copy link
Copy Markdown
Contributor

@liuzzi liuzzi commented May 9, 2020

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.

@LysandreJik
Copy link
Copy Markdown
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?

@liuzzi
Copy link
Copy Markdown
Contributor Author

liuzzi commented May 11, 2020

@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.

@LysandreJik
Copy link
Copy Markdown
Member

I just pushed the tests on it, thanks for your contribution!

@LysandreJik LysandreJik force-pushed the electra-sequence-classification branch from 29db302 to 6d02ff3 Compare May 22, 2020 13:47
@LysandreJik LysandreJik merged commit bd6e301 into huggingface:master May 22, 2020
@LysandreJik
Copy link
Copy Markdown
Member

Pushed a style change, rebased and merged into master. Thanks @liuzzi !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants