Missing upper bound in numpy requirements breaks transformers
Author: Resteklicken
Pull request: no

### System Info

I am using:
- python 3.11
- transformers 4.41.2
- python:3.11-slim-bullseye as base image
- poetry for dependency management

transformers entry in `poetry.lock`:
```json
[[package]]
name = "transformers"
version = "4.41.2"
description = "State-of-the-art Machine Learning for JAX, PyTorch and TensorFlow"
optional = false
python-versions = ">=3.8.0"
files = [
    {file = "transformers-4.41.2-py3-none-any.whl", hash = "sha256:05555d20e43f808de1ef211ab64803cdb513170cef70d29a888b589caebefc67"},
    {file = "transformers-4.41.2.tar.gz", hash = "sha256:80a4db216533d573e9cc7388646c31ed9480918feb7c55eb211249cb23567f87"},
]

[package.dependencies]
filelock = "*"
huggingface-hub = ">=0.23.0,<1.0"
numpy = ">=1.17"
packaging = ">=20.0"
pyyaml = ">=5.1"
regex = "!=2019.12.17"
requests = "*"
safetensors = ">=0.4.1"
tokenizers = ">=0.19,<0.20"
tqdm = ">=4.27"
```

Since `numpy` has no upper version bound set, it gets upgraded to 2.0.0 when updating dependencies after the major release last week.

```bash
$ poetry show numpy             
 name         : numpy                                             
 version      : 2.0.0                                             
 description  : Fundamental package for array computing in Python 

required by
 - transformers >=1.17
```

This leads to at least one critical error at runtime, but I suspect there are way more:

```
predictions: List[List[Any]] = self.pipeline(
^^^^^^^^^^^^^^
File "/opt/app/.venv/lib/python3.11/site-packages/transformers/pipelines/text_classification.py", line 156, in __call__
result = super().__call__(*inputs, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/app/.venv/lib/python3.11/site-packages/transformers/pipelines/base.py", line 1224, in __call__
outputs = list(final_iterator)
^^^^^^^^^^^^^^^^^^^^
File "/opt/app/.venv/lib/python3.11/site-packages/transformers/pipelines/pt_utils.py", line 125, in __next__
processed = self.infer(item, **self.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/app/.venv/lib/python3.11/site-packages/transformers/pipelines/text_classification.py", line 205, in postprocess
outputs = outputs.numpy()
^^^^^^^^^^^^^^^
RuntimeError: Numpy is not available
```

### Who can help?

@Narsil 

### Information

- [ ] The official example scripts
- [X] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [X] My own task or dataset (give details below)

### Reproduction

1. Start in a clean env without numpy installed.
2. Install transformers.
3. numpy will be installed in version 2.0.0.
4. Try using a TextClassificationPipeline
5. Observe output mentioned above.

### Expected behavior

The TextClassificationPipeline should work the same as before the numpy 2.0 release last week.
numpy should be version-contrained in transformers' requirements to a version <2.0.0 until full API compatibility is reached.

Comments:
cc @ydshieh 

Indeed. But may I know how you install `transformers`? Usually due to the dependencies of other 3rd party libraries, it is automatically constrained to np < 2.0.

> Indeed. But may I know how you install `transformers`? Usually due to the dependencies of other 3rd party libraries, it is automatically constrained to np < 2.0.

Thanks for the quick reaction! 
I install dependencies via poetry and can give you the dependencies from my pyproject.toml tomorrow once I'm back at work.

@ydshieh Here's the dependency list:

```toml
[tool.poetry.dependencies]
python = "^3.11"
google-cloud-storage = "^2.9.0"
fastapi = { version = "^0.100.0", extras = ["all"] }
pydantic = "^2.0.0"
pytz = "^2023.3.post1"
torch = { url = "https://download.pytorch.org/whl/cpu/torch-2.1.2%2Bcpu-cp311-cp311-linux_x86_64.whl" }
transformers = "^4.29.2"
networkx = "^3.2.1"
```

These get installed into a fresh environment on every build. None of the other libraries depend on numpy, which is indeed rare I suppose. 

Thank you.

Let me know if you still have the same issue after  #31569 (merged).