The first inference timing for pure PyTorch is unexpectedly fast and should be ignored
## Environment info
<!-- You can run the command `transformers-cli env` and copy-and-paste its output below.
     Don't forget to fill out the missing fields in that output! -->

- `transformers` version: 4.11.3
- Platform: Linux-5.4.0-1056-azure-x86_64-with-glibc2.10
- Python version: 3.8.5
- PyTorch version (GPU?): 1.9.1+cu102 (True)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: yes
- Using distributed or parallel set-up in script?:

### Who can help
<!-- Your issue 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, DeBERTa, DeBERTa-v2, ELECTRA, MobileBert, SqueezeBert: @LysandreJik
- encoder-decoder models (For example, BlenderBot, BART, Marian, Pegasus, T5, ByT5): @patrickvonplaten, @patil-suraj
- Longformer, Reformer, TransfoXL, XLNet, FNet: @patrickvonplaten
- FSMT: @stas00
- Funnel: @sgugger
- GPT-2, GPT: @patrickvonplaten, @LysandreJik
- RAG, DPR: @patrickvonplaten, @lhoestq
- TensorFlow: @Rocketknight1
- JAX/Flax: @patil-suraj @patrickvonplaten 
- TAPAS, LayoutLM, LayoutLMv2, LUKE, ViT, BEiT, DEiT, DETR, CANINE: @NielsRogge
- GPT-Neo, GPT-J, CLIP: @patil-suraj
- Wav2Vec2, HuBERT, SpeechEncoderDecoder: @patrickvonplaten, @anton-l

If the model isn't in the list, ping @LysandreJik who will redirect you to the correct contributor.

Library:

- Benchmarks: @patrickvonplaten
- Deepspeed: @stas00
- Ray/raytune: @richardliaw, @amogkam
- Text generation: @patrickvonplaten
- Tokenizers: @LysandreJik
- Trainer: @sgugger
- Pipelines: @Narsil
- Speech: @patrickvonplaten, @anton-l
- Vision: @NielsRogge, @sgugger

Documentation: @sgugger

Model hub:

- for issues with a model, report at https://discuss.huggingface.co/ and tag the model's creator.

HF projects:

- datasets: [different repo](https://github.com/huggingface/datasets)
- rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)

Examples:

- maintained examples (not research project or legacy): @sgugger, @patil-suraj

For research projetcs, please ping the contributor directly. For example, on the following projects:

- research_projects/bert-loses-patience: @JetRunner
- research_projects/distillation: @VictorSanh

 -->

## Information

Hi, thanks for the benchmark library, which has helped me simplify a lot in my project.

But I ran into a strange issue that the inference speed slows down when using `torchscript=True`. After digging into this issue, I found that the first timing for `torchscript=False` is strangely fast. (see below section for the details)
I think it is better to perform warmup for all situations instead of only:
https://github.com/huggingface/transformers/blob/91758e399f8c4bf81820a8af6a257682ccea0223/src/transformers/benchmark/benchmark.py#L198

I will be happy to send a PR if this suggestion is accepted.


## To reproduce

Steps to reproduce the behavior:

```python
# test.py
from transformers import PyTorchBenchmark, PyTorchBenchmarkArguments

args = PyTorchBenchmarkArguments(models=["bert-base-uncased"], batch_sizes=[8], sequence_lengths=[512], torchscript=False, env_print=True)
benchmark = PyTorchBenchmark(args)
benchmark.run()
```
1. Add `print(runtimes)` at L213

https://github.com/huggingface/transformers/blob/91758e399f8c4bf81820a8af6a257682ccea0223/src/transformers/benchmark/benchmark.py#L208-L212



2. Run `test.py` with `torchscript=False`

```
[1.2410342500079423, 1.7289500490296632, 1.7288817439693958, 1.7287787408567965, 1.7287089368328452]
====================       INFERENCE - SPEED - RESULT       ====================
--------------------------------------------------------------------------------
          Model Name             Batch Size     Seq Length     Time in s   
--------------------------------------------------------------------------------
      bert-base-uncased              8              512            0.124     
--------------------------------------------------------------------------------
...
```

3. Run `test.py` with `torchscript=True`

```
[1.6381433540955186, 1.6382532438728958, 1.6387098210398108, 1.6382117359898984, 1.6384075228124857]

====================       INFERENCE - SPEED - RESULT       ====================
--------------------------------------------------------------------------------
          Model Name             Batch Size     Seq Length     Time in s   
--------------------------------------------------------------------------------
      bert-base-uncased              8              512            0.164     
--------------------------------------------------------------------------------

...

====================        ENVIRONMENT INFORMATION         ====================
- transformers_version: 4.11.3
- framework: PyTorch
- use_torchscript: True
- framework_version: 1.9.1+cu102
- python_version: 3.8.5
- system: Linux
- cpu: x86_64
- architecture: 64bit
- date: 2021-10-09
- time: 14:50:09.526534
- fp16: False
- use_multiprocessing: True
- only_pretrain_model: False
- cpu_ram_mb: N/A
- use_gpu: True
- num_gpus: 1
- gpu: N/A
- gpu_ram_mb: N/A
- gpu_power_watts: N/A
- gpu_performance_state: N/A
- use_tpu: False
```


<!-- If you have code snippets, error messages, stack traces please provide them here as well.
     Important! Use code tags to correctly format your code. See https://help.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks#syntax-highlighting
     Do not use screenshots, as they are hard to read and (more importantly) don't allow others to copy-and-paste your code.-->

## Expected behavior

<!-- A clear and concise description of what you would expect to happen. -->

Perform warmup for all situations to avoid getting unexpected inference speed.
It would be nice if someone could shed light on this strange behavior. :)<|||||>@patrickvonplaten 
Hello, I found from the guide that you are the right people for the benchmark library. :smile:
Do you think this suggestion should be accepted?<|||||>This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/master/CONTRIBUTING.md) are likely to be ignored.<|||||>Hey @siahuat0727,

Thanks for your issue. We don't actively maintain the benchmarking tools of `transformers` anymore and also recommend to not use it as it's quite outdated and has not been shown to be very accurate. 