"inputs" argument in pipelines not working if it's explicitly specified
Author: Keredu
Pull request: no

### System Info

transformers==4.33.0
sentencepiece==0.1.99
torch==2.0.1

### 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, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

```python
from transformers import pipeline

classifier = pipeline(
    task="sentiment-analysis",
    model="distilbert-base-uncased-finetuned-sst-2-english",
)

res = classifier(inputs=["I've been waiting for a HuggingFace course my whole life.",
                         "I hate this so much!"])

print(res)
```
When using the code from above, it throws an ``IndexError: tuple index out of range`` error. However, when running the following code, it works fine:
```python
from transformers import pipeline

classifier = pipeline(
    task="sentiment-analysis",
    model="distilbert-base-uncased-finetuned-sst-2-english",
)

res = classifier(["I've been waiting for a HuggingFace course my whole life.",
                         "I hate this so much!"])

print(res)
```
I have tried to debug it and it looks like in L156 of [text_classification.py](https://github.com/huggingface/transformers/blob/fa6107c97edf7cf725305a34735a57875b67d85e/src/transformers/pipelines/text_classification.py#L156), depending on if the "inputs" argument is specified, the list is passed in the args or in the kwargs:
1. If it's explicitly specified (i.e. passed as kwargs),  when calling the super() method, it goes to L1077 in [base.py](https://github.com/huggingface/transformers/blob/fa6107c97edf7cf725305a34735a57875b67d85e/src/transformers/pipelines/base.py#L1077) and it works fine but then, when it returns to the text_classfication.py file and tries to execute the [L159](https://github.com/huggingface/transformers/blob/fa6107c97edf7cf725305a34735a57875b67d85e/src/transformers/pipelines/text_classification.py#L159) of text_classification.py (``isinstance(args[0], str)``), it throws the following error ``IndexError: tuple index out of range`` because args is empty. 
2. If it's not explicitly specified (i.e. passed as args), it works perfectly since ``isinstance(args[0], str)`` on L159 of text_classification.py  doesn't throw the error because we passed the inputs as args so it's not empty.


### Expected behavior

I would expect that both code snippets return the same output:
```python
[{'label': 'POSITIVE', 'score': 0.9598049521446228}, {'label': 'NEGATIVE', 'score': 0.9994558691978455}]
```

TBH, I'm not sure if it's a bug or this behaviour is intended. In case it's a bug, I'd be glad to help fix it.

Comments:
Hey thanks for sharing. The bug is indeed here: https://github.com/huggingface/transformers/blob/fa6107c97edf7cf725305a34735a57875b67d85e/src/transformers/pipelines/text_classification.py#L159

It is introduced by the legacy layer.

The fix would be checking `args[0]` or ` inputs` but enforcing at least one exists.

I'm up for a change if it helps (since the code would still be contained and clearly identifiable as legacy)

I just created a pull request with a possible solution: #26028 

I checked the tests for text_classification but I didn't considered necessary to make any new test. If you think I should add or modify anything, tell me.

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/main/CONTRIBUTING.md) are likely to be ignored.