Allow `trust_remote_code` in example scripts
Author: Jackmin801
Pull request: yes

# 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 -->

Update example scripts to use `trust_remote_code`.

This PR is similar to https://github.com/huggingface/transformers/pull/25167 but for adding the `trust_remote_code` arg instead of updating the `token` arg.
I am not sure if this feature is welcome so I have only modified pytorch `run_glue.py` for now.
I will modify the other files (every file that was modified in https://github.com/huggingface/transformers/pull/25167) if the change is welcome and after you all are happy with the help string

## 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/main/CONTRIBUTING.md#start-contributing-pull-requests),
      Pull Request section?
- [ ] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case.
- [ ] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [ ] Did you write any new necessary tests?


## Who can review?
@ydshieh @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:

- text models: @ArthurZucker and @younesbelkada
- vision models: @amyeroberts
- speech models: @sanchit-gandhi
- graph models: @clefourrier

Library:

- flax: @sanchit-gandhi
- generate: @gante
- pipelines: @Narsil
- tensorflow: @gante and @Rocketknight1
- tokenizers: @ArthurZucker
- trainer: @sgugger

Integrations:

- deepspeed: HF Trainer/Accelerate: @pacman100
- ray/raytune: @richardliaw, @amogkam

Documentation: @sgugger, @stevhliu and @MKhalusova

HF projects:

- accelerate: [different repo](https://github.com/huggingface/accelerate)
- datasets: [different repo](https://github.com/huggingface/datasets)
- diffusers: [different repo](https://github.com/huggingface/diffusers)
- rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)

Maintained examples (not research project or legacy):

- Flax: @sanchit-gandhi
- PyTorch: @sgugger
- TensorFlow: @Rocketknight1

 -->


Comments:
_The documentation is not available anymore as the PR was closed or merged._

Will do flax and tf tomorrow. I have a few questions though:
1. @ydshieh, this script is still using `use_auth_token`. Is this intended? 
https://github.com/huggingface/transformers/blob/main/examples/pytorch/image-pretraining/run_mim_no_trainer.py#L450
2. This script doesnt use `token` or `use_auth_token` for the tokenizer
https://github.com/huggingface/transformers/blob/main/examples/pytorch/contrastive-image-text/run_clip.py#L333-L340
3. The Permutation Language Modeling [script](https://github.com/huggingface/transformers/blob/main/examples/pytorch/language-modeling/run_plm.py) only uses Auto for config and tokenizer, the model is hardcoded to XLNet. So there are 2 options:
  a. Not put `trust_remote_code` in this script -- only the transformers XLNet will be supported.
  b. Change the XLNet lines to use Auto, though Im not sure which Auto to use here.



>     1. @ydshieh, this script is still using `use_auth_token`. Is this intended?
No, it's a miss from my side. Nice catch and thanks!

>     2. This script doesnt use `token` or `use_auth_token` for the tokenizer
>        https://github.com/huggingface/transformers/blob/main/examples/pytorch/contrastive-image-text/run_clip.py#L333-L340
It's probably already been this even before my `token` PRs. I will update them too :-)


>     3. The Permutation Language Modeling [script](https://github.com/huggingface/transformers/blob/main/examples/pytorch/language-modeling/run_plm.py) only uses Auto for config and tokenizer, the model is hardcoded to XLNet. So there are 2 options:
>        a. Not put `trust_remote_code` in this script -- only the transformers XLNet will be supported.

Let's just keep `a` .

Looking forward your PR completed 🚀 



Couple more places not using `token` or `use_auth_token`
- Tensorflow examples
  - run_clip: Tokenizer
  - run_clm: Config, Tokenizer, Model
  - run_mlm: Config, Tokenizer, Model
  - run_ner: Config, Tokenizer, Model
 
Most of the no_trainer scripts don't have `token` or `use_auth_token` in the args.
Do we want to add them?

That's all the places where `trust_remote_code` can be used in the examples that I am aware of.
@ydshieh, would appreciate a review. Thanks!

Thanks for the information! I will take care of `token` this week.

> Most of the no_trainer scripts don't have token or use_auth_token in the args. Do we want to add them?
Let's not adding things to them in this PR. We can take a look once this PR being merged.

> @ydshieh, would appreciate a review. Thanks!

Sure!


The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_25248). All of your documentation changes will be reflected on that endpoint.