

TITLE
Bug of the text-classification in examples

COMMENTS
0

REACTIONS
+1: 0
-1: 0
laugh: 0
hooray: 0
heart: 0
rocket: 0
eyes: 0

BODY
### System Info

```shell
When I finetuned the text classification model based on the glue no trainer script, I found a bug in our script.
The URL is below:
https://github.com/huggingface/transformers/blob/main/examples/pytorch/text-classification/run_glue_no_trainer.py#L525

When we use the accelerator for multi-GPU training, the code should transfer from 
if step == len(eval_dataloader)
to 
if step == len(eval_dataloader) -1
Otherwise, it cannot work to filter the last step duplicated samples.
```


### Who can help?

_No response_

### 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

just run the script with a text classification using multi-GPU accelerator. The problem occurs in the last step for duplicated samples.

### Expected behavior

```shell
I think it should be fixed soon.
```
