A script to add/update `pipeline_model_mapping` systematically
# What does this PR do?

This script will ease the process of adding and/or updating `pipeline_model_mapping` in test files in the future, in a systematical way (no manual editing).

This is also one part of the process of [tiny model creation/upload + tiny model info update + **test file update**]

The basic idea: For a test file: 
  - find a test class
  - check if `pipeline_model_mapping` is already defined
    - yes + overwrite is `True`: remove it (more precisely, mark them to be removed, and remove them before writing to file)
  - compute `pipeline_model_mapping` via the mappings defined in `XXXPipelineTests` classes defined in files in `tests/pipelines/test_xxx.py`
  - compute the position to which we add `pipeline_model_mapping`
  - add `pipeline_model_mapping` and write to file

Remark: There are (very) few exception cases not handled in this PR. For example, 2 test classes defined in a single test file, like `Blip2ForConditionalGenerationDecoderOnlyTest` and `Blip2ModelTest`.

Example usage / demo:

```python
python utils\add_pipeline_model_mapping_to_test.py --test_file tests\models\bert\test_modeling_bert.py --overwrite
```

Request @sgugger for review, as he is involved in a few related PRs before. If the core maintainers decide to let @amyeroberts to review, I can provide more context (regarding previous PRs) for her to ease the review process.<|||||>_The documentation is not available anymore as the PR was closed or merged._<|||||>I think I should add a test for this new script, just like `tests/repo_utils/test_tests_fetcher.py` that tests the script `utils/tests_fetcher.py`.

However, this script needs file(s) in `tests/model/` and require models being in `transformers`. I might need to see if there is similar cases being done before to implement a test for this new script.<|||||>Hey @ydshieh, thanks for your PR! In which settings would you want to leverage such a script? Would it be when users contribute new models?<|||||>Hi @LysandreJik 

I am thinking it is better to have a CI job that runs this script in a regular basis (as a check, or even open a PR automatically), similar to #22275.
At some occasions, we (`transformers` members) might want to run it for a particular test file to check/update something quickly.

I don't expect contributors to run this - fewer steps, less friction and happier  for them :-)
<|||||>If it makes your workflow simpler then why not, but I would make it very explicit what this script does and document it (even in the script directly). If I had trouble understanding what it was for/when and who should use it, I figure others will have the same problem :)

Thanks!<|||||>> If it makes your workflow simpler then why not, but I would make it very explicit what this script does and document it (even in the script directly). If I had trouble understanding what it was for/when and who should use it, I figure others will have the same problem :)
> 
> Thanks!

Nice point ❤️.I will add some comments in the script. Thank you for the feedback.<|||||>@LysandreJik Hope you will ❤️ the added comment added in

https://github.com/huggingface/transformers/pull/22180/commits/87433ee115ba14b509df6386d2feff8e7ad41567

<|||||>(just rebase on `main`)<|||||>Hi @LysandreJik .  A description is added in [this commit](https://github.com/huggingface/transformers/pull/22180/commits/87433ee115ba14b509df6386d2feff8e7ad41567). Let me know if you have any further comment/review(s) :-). Thank you.<|||||>Just fix a few things before merging. Nothing really big.

I have use this new script to update the attributes in #22606.