Skip to content

Expand a bit the presentation of examples#10799

Merged
sgugger merged 3 commits intomasterfrom
examples_readme
Mar 19, 2021
Merged

Expand a bit the presentation of examples#10799
sgugger merged 3 commits intomasterfrom
examples_readme

Conversation

@sgugger
Copy link
Copy Markdown
Collaborator

@sgugger sgugger commented Mar 18, 2021

What does this PR do?

This PR adds a bit more information to the examples README (main and specific per example), copying some information from the main philosophy and expanding a bit, to make sure all users know what we want for the examples.

@sgugger sgugger requested review from LysandreJik and stas00 March 18, 2021 21:03
Copy link
Copy Markdown
Contributor

@stas00 stas00 left a comment

Choose a reason for hiding this comment

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

That is very helpful, thank you, @sgugger!

Left a few small tweaks and a question

Comment thread examples/README.md
This folder contains actively maintained examples of use of 🤗 Transformers organized along NLP tasks. If you are looking for an example that used to
be in this folder, it may have moved to our [research projects](https://github.com/huggingface/transformers/tree/master/examples/research_projects) subfolder (which contains frozen snapshots of research projects).
This folder contains actively maintained examples of use of 🤗 Transformers organized along NLP tasks. If you are looking for an example that used to be in this folder, it may have moved to our [research projects](https://github.com/huggingface/transformers/tree/master/examples/research_projects) subfolder (which contains frozen snapshots of research projects).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what about examples/legacy? it seems that we have 2 of these now

Comment thread examples/README.md Outdated
Comment thread examples/README.md Outdated
Comment thread examples/language-modeling/README.md Outdated
Comment thread examples/multiple-choice/README.md Outdated
#### Fine-tuning on SWAG
## PyTorch script: fine-tuning on SWAG

`run_swag` allows you to fine-tune any model from our [hub](https://huggingface.co/models) on the SWAG dataset or your own csv/jsonlines files as long as they are structured the same way. To make it works on another dataset, you will need to tweak the `preprocess_function` inside the script.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it can't be any model, no? any model trained on text-classification perhaps?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It's pretty much any model yes, as long as they have a ForMultipleChoice head.

Copy link
Copy Markdown
Contributor

@stas00 stas00 Mar 18, 2021

Choose a reason for hiding this comment

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

I found only 18:

src/transformers/utils/dummy_pt_objects.py:class AlbertForMultipleChoice:
src/transformers/utils/dummy_pt_objects.py:class AutoModelForMultipleChoice:
src/transformers/utils/dummy_pt_objects.py:class BertForMultipleChoice:
src/transformers/utils/dummy_pt_objects.py:class CamembertForMultipleChoice:
src/transformers/utils/dummy_pt_objects.py:class ConvBertForMultipleChoice:
src/transformers/utils/dummy_pt_objects.py:class DistilBertForMultipleChoice:
src/transformers/utils/dummy_pt_objects.py:class ElectraForMultipleChoice:
src/transformers/utils/dummy_pt_objects.py:class FlaubertForMultipleChoice:
src/transformers/utils/dummy_pt_objects.py:class FunnelForMultipleChoice:
src/transformers/utils/dummy_pt_objects.py:class IBertForMultipleChoice:
src/transformers/utils/dummy_pt_objects.py:class LongformerForMultipleChoice:
src/transformers/utils/dummy_pt_objects.py:class MobileBertForMultipleChoice:
src/transformers/utils/dummy_pt_objects.py:class MPNetForMultipleChoice:
src/transformers/utils/dummy_pt_objects.py:class RobertaForMultipleChoice:
src/transformers/utils/dummy_pt_objects.py:class SqueezeBertForMultipleChoice:
src/transformers/utils/dummy_pt_objects.py:class XLMForMultipleChoice:
src/transformers/utils/dummy_pt_objects.py:class XLMRobertaForMultipleChoice:
src/transformers/utils/dummy_pt_objects.py:class XLNetForMultipleChoice:

may be it could just say that: "any model, as long as it has a ForMultipleChoice head" - same for the other one.

multiple-choice is missing from the tasks on the left side of the hub UI.

I tried: https://huggingface.co/models?pipeline_tag=multiple-choice

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Will adapt with this, and also will make a nice table showing which model have which head for our documentation one of these days. Once it's there we can link to it.

Copy link
Copy Markdown
Contributor

@stas00 stas00 Mar 19, 2021

Choose a reason for hiding this comment

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

great and for qa it's:

grep -Ir ForQuestionAnswering src | grep -v TF | grep dummy | perl -lne 'm|class (.*):| && print($1)'
AlbertForQuestionAnswering
AutoModelForQuestionAnswering
BartForQuestionAnswering
BertForQuestionAnswering
CamembertForQuestionAnswering
ConvBertForQuestionAnswering
DebertaForQuestionAnswering
DebertaV2ForQuestionAnswering
DistilBertForQuestionAnswering
ElectraForQuestionAnswering
FlaubertForQuestionAnswering
FlaubertForQuestionAnsweringSimple
FunnelForQuestionAnswering
IBertForQuestionAnswering
LEDForQuestionAnswering
LongformerForQuestionAnswering
LxmertForQuestionAnswering
MBartForQuestionAnswering
MobileBertForQuestionAnswering
MPNetForQuestionAnswering
ReformerForQuestionAnswering
RobertaForQuestionAnswering
SqueezeBertForQuestionAnswering
TapasForQuestionAnswering
XLMForQuestionAnswering
XLMForQuestionAnsweringSimple
XLMRobertaForQuestionAnswering
XLNetForQuestionAnswering
XLNetForQuestionAnsweringSimple

Comment thread examples/question-answering/README.md Outdated
@stas00
Copy link
Copy Markdown
Contributor

stas00 commented Mar 18, 2021

I'd be super-handy to link directly to suitable datasets and models for each example as in

may be this could be an easy first good issue.

Some of the keywords and whether to use ?filter= or ?search= will require some investigation since the former is hidden and packs some power missing from the latter.

@sgugger
Copy link
Copy Markdown
Collaborator Author

sgugger commented Mar 18, 2021

The first may be helpful, but the second is not necessarily: it shows the models that have been fine-tuned on a squad dataset, not the models that can be fine-tuned on it. There is no way to filter all the models that have an architecture containing a question-answering head as far as I know, which is what we would want to show.

Co-authored-by: Stas Bekman <stas00@users.noreply.github.com>
@stas00
Copy link
Copy Markdown
Contributor

stas00 commented Mar 18, 2021

Would this be at least in the right direction? https://huggingface.co/models?pipeline_tag=question-answering

@sgugger
Copy link
Copy Markdown
Collaborator Author

sgugger commented Mar 19, 2021

Mmm, those seem to be models fine-tuned on a question-answering task, not all models with a QuestionAnswering arch available (for instance, you should see all BERT checkpoints, all distilBERT checkpoints etc).

@stas00
Copy link
Copy Markdown
Contributor

stas00 commented Mar 19, 2021

OK, then it won't work.

It'd be really awesome if in the future we had a filter to filter models by architecture - and sub-architecture in this case - that is without the model-specific part of the class name.

Copy link
Copy Markdown
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

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

This is great, thanks for updating the notes @sgugger. I think this should help clarify things.

@sgugger sgugger merged commit 946400f into master Mar 19, 2021
@sgugger sgugger deleted the examples_readme branch March 19, 2021 14:06
Iwontbecreative pushed a commit to Iwontbecreative/transformers that referenced this pull request Jul 15, 2021
* Expand a bit the presentation of examples

* Apply suggestions from code review

Co-authored-by: Stas Bekman <stas00@users.noreply.github.com>

* Address review comments

Co-authored-by: Stas Bekman <stas00@users.noreply.github.com>
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.

3 participants