Skip to content

Conversation

@nateraw
Copy link
Contributor

@nateraw nateraw commented Mar 16, 2020

This PR adds an example of using Pytorch Lightning to run the GLUE benchmark. Additionally, I altered the transformer_base.py to use auto models and moved it to the example directory so it could be copied in by any script that wishes to use it.

Preferably, the base transformer would have subclasses for the different types of tasks, but I just used a dictionary with a key passed on init instead. (i.e. NER uses AutoModelForTokenClassification and GLUE uses AutoModelForSequenceClassification).

@nateraw
Copy link
Contributor Author

nateraw commented Mar 16, 2020

@srush Can you please take a look?

@codecov-io
Copy link

codecov-io commented Mar 16, 2020

Codecov Report

Merging #3290 into master will increase coverage by 0.18%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3290      +/-   ##
==========================================
+ Coverage   77.81%   77.99%   +0.18%     
==========================================
  Files          98       98              
  Lines       16666    16666              
==========================================
+ Hits        12969    12999      +30     
+ Misses       3697     3667      -30     
Impacted Files Coverage Δ
src/transformers/modeling_utils.py 93.84% <0.00%> (+0.27%) ⬆️
src/transformers/modeling_tf_utils.py 87.47% <0.00%> (+5.00%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8320fee...dd1b783. Read the comment docs.

Copy link
Contributor

@srush srush left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done. Pretty impressive how little code needed to change.

While you are doing this, I think you can be a bit more aggressive about moving code up to basetransformer and moving the manual logging to loggers. But otherwise the code looks great.

Not sure the best way to pull in BaseTransformer.py. The easiest is sys.path.append("../")

@nateraw nateraw requested a review from srush March 17, 2020 00:14
@srush
Copy link
Contributor

srush commented Mar 17, 2020

Looks excellent. I will let @LysandreJik merge tomorrow, and confirm multi-gpu / TPU work.

Want to try SQuAD next?

@nateraw
Copy link
Contributor Author

nateraw commented Mar 17, 2020

Want to try SQuAD next?

Sure, I'll give it a go.

@srush srush merged commit 930c941 into huggingface:master Mar 17, 2020
jplu pushed a commit to jplu/transformers that referenced this pull request Mar 25, 2020
* ✨ Alter base pl transformer to use automodels

* 🐛 Add batch size env variable to function call

* 💄 Apply black code style from Makefile

* 🚚 Move lightning base out of ner directory

* ✨ Add lightning glue example

* 💄 self

* move _feature_file to base class

* ✨ Move eval logging to custom callback

* 💄 Apply black code style

* 🐛 Add parent to pythonpath, remove copy command

* 🐛 Add missing max_length kwarg
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.

4 participants