Errors when using transformers dev install
Author: samuelzxu
Pull request: no

### System Info

- `transformers` version: 4.26.0.dev0
- Platform: Linux-5.15.0-57-generic-x86_64-with-glibc2.35
- Python version: 3.9.0
- Huggingface_hub version: 0.11.1
- PyTorch version (GPU?): 1.13.1+cu117 (False)
- Tensorflow version (GPU?): 2.11.0 (False)
- Flax version (CPU?/GPU?/TPU?): 0.5.0 (cpu)
- Jax version: 0.3.6
- JaxLib version: 0.3.5
- Using GPU in script?: no
- Using distributed or parallel set-up in script?: no


### Who can help?

@sgugger @Rocketknight1

### Information

- [X] The official example scripts
- [ ] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

1. `python -m pip uninstall transformers`
2. `python -m pip install -e ".[dev]"`
3. `make fix-copies`

Here's the error message when I run the copy checking function:

```
$ python utils/check_copies.py --fix_and_overwrite

2023-01-11 23:05:36.590052: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-01-11 23:05:36.726808: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory
2023-01-11 23:05:36.726831: I tensorflow/compiler/xla/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2023-01-11 23:05:37.362737: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory
2023-01-11 23:05:37.362802: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory
2023-01-11 23:05:37.362811: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.
```

I played around with it and a similar error occurs whenever I try to import transformers:

```
>>> import transformers

2023-01-11 23:21:57.034819: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-01-11 23:21:57.183106: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory
2023-01-11 23:21:57.183131: I tensorflow/compiler/xla/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2023-01-11 23:21:57.863217: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory
2023-01-11 23:21:57.863294: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory
2023-01-11 23:21:57.863305: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.
```
And after some more poking, it looks like whenever I use Tensorflow (but not Pytorch) this error pops up:

```
>>> model = TFAutoModelForSequenceClassification.from_pretrained("distilbert-base-uncased")

2023-01-11 23:26:25.903590: E tensorflow/compiler/xla/stream_executor/cuda/cuda_driver.cc:267] failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected
2023-01-11 23:26:25.903681: I tensorflow/compiler/xla/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (ziggy-ThinkPad-T480): /proc/driver/nvidia/version does not exist
2023-01-11 23:26:25.905701: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
```

I have no idea why it keeps trying to use CUDA related functions when I don't have a GPU. Does the dev install assume that I have a GPU?


### Expected behavior

I expect the script to output something of this sort:

```
python utils/check_copies.py --fix_and_overwrite
Detected changes, rewriting src/transformers/models/xlm_roberta/modeling_tf_xlm_roberta.py.
```

The above output was from a colab notebook (with gpu) that I installed the dev environment onto.

Comments:
This is not an error message, but a warning. It comes from TensorFlow warning you you don't have any GPU installed. This is nothing linked to Transformers.

Thanks! I see now that it was just taking a very long time to run, so I assumed the message was an error.

This is actually quite an odd error, though - I don't get it when I run `fix_copies`, and I can't think of why TF would even be imported in that script. Marking this as 'mysterious', and I'll come back to it if I ever figure out why it was happening to you!

These warnings also happen to me when I dev install transformers on Google Colab.

Moreover, it seems that the first generation with `model.generate` is slower when this happens. There is a freeze of a few seconds in this first inference.