Added max_sample_ arguments
Author: bhadreshpsavani
Pull request: yes
Labels: name: Examples

# What does this PR do?

<!--
Congratulations! You've made it this far! You're not quite done yet though.

Once merged, your PR is going to appear in the release notes with the title you set, so make sure it's a great title that fully reflects the extent of your awesome contribution.

Then, please replace this with a description of the change and which issue is fixed (if applicable). Please also include relevant motivation and context. List any dependencies (if any) that are required for this change.

Once you're done, someone will review your PR shortly (see the section "Who can review?" below to tag some potential reviewers). They may suggest changes to make the code even better. If no one reviewed your PR after a week has passed, don't hesitate to post a new comment @-mentioning the same persons---sometimes notifications get lost.
-->

<!-- Remove if not applicable -->

Fixes #10437 #10423

## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [x] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/master/CONTRIBUTING.md#start-contributing-pull-requests),
      Pull Request section?
- [x] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)?  #10437 
- [ ] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/master/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/master/docs#writing-source-documentation).
- [ ] Did you write any new necessary tests?

## Notes:
All the PyTorch-based examples except the below two files will have support for the arguments by adding these changes.
1. The same changes can be implemented for `run_mlm_flax.py` but since I couldn't test the changes I didn't make changes to that file.
2. `run_generation.py`  
* I have reverted the code changes for three TF-based examples since it was giving an error and we want to keep it as it is.
* Test/Predict code addition is still pending. I will do it next.
## review:
@stas00  @sgugger 

<!-- Your PR will be replied to more quickly if you can figure out the right person to tag with @

 If you know how to use git blame, that is the easiest way, otherwise, here is a rough guide of **who to tag**.
 Please tag fewer than 3 people.

Models:

- albert, bert, xlm: @LysandreJik
- blenderbot, bart, marian, pegasus, encoderdecoder,  t5: @patrickvonplaten, @patil-suraj
- longformer, reformer, transfoxl, xlnet: @patrickvonplaten
- fsmt: @stas00
- funnel: @sgugger
- gpt2: @patrickvonplaten, @LysandreJik
- rag: @patrickvonplaten, @lhoestq
- tensorflow: @jplu

Library:

- benchmarks: @patrickvonplaten
- deepspeed: @stas00
- ray/raytune: @richardliaw, @amogkam
- text generation: @patrickvonplaten
- tokenizers: @n1t0, @LysandreJik
- trainer: @sgugger
- pipelines: @LysandreJik

Documentation: @sgugger

HF projects:

- nlp datasets: [different repo](https://github.com/huggingface/nlp)
- rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)

Examples:

- maintained examples (not research project or legacy): @sgugger, @patil-suraj
- research_projects/bert-loses-patience: @JetRunner
- research_projects/distillation: @VictorSanh

 -->


Comments:
Thank you for having a closer look that I did, @sgugger.

Ideally we should have tests that would have caught this

Hi @stas00,

How can we add test cases for this testing? If we check `max_train_samples` and `max_valid_samples` from metrics and add assert statement that might be possible.
 

> How can we add test cases for this testing? If we check `max_train_samples` and `max_valid_samples` from metrics and add assert statement that might be possible.

Yes, that's exactly the idea

Hi @stas00,

What should I do if I got this error while using git,
```
$ git push origin argument-addition
To https://github.com/bhadreshpsavani/transformers.git
 ! [rejected]            argument-addition -> argument-addition (non-fast-forward)
error: failed to push some refs to 'https://github.com/bhadreshpsavani/transformers.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
```

I found that I need to use this command `git push -f origin argument-addition` with fast-forward flag.
Thanks, @stas00 I used your rebase script. It's cool! I did it the first time!

Some unrelated to your work CI tests were failing so I rebased your PR branch to master, and then they passed. You may have not noticed that.

So you needed to do `git pull` before continuing pushing. and if you already made some changes and `git pull` doesn't work because an update was made in files that you locally modify, you normally do:
```
git stash
git pull
git stash pop
```
and deal with merge conflicts if any emerge.

In general force-pushing should only be reserved for when a bad mistake was made and you need to undo some damage.

So your force-pushing undid the changes I pushed. But since you then rebased it's the same as what I did. No damage done in this situation.

But please be careful in the future and first understand why you think of doing force pushing.

Okay @stas00,
I will be careful while using force push I will use `stash`.
Now I understood

Hello @stas00 and @sgugger,
I have made the suggested changes
Please let me know if any other changes are required
Thanks

@LysandreJik I think this is ready for final review and merge if you're happy with it.