TypeError: TextInputSequence must be str
Author: choshiho
Pull request: no
Labels: name: bug

### System Info

- `transformers` version: 4.20.1
- Platform: Linux-3.10.0-1160.6.1.el7.x86_64-x86_64-with-glibc2.17
- Python version: 3.9.7
- Huggingface_hub version: 0.7.0
- PyTorch version (GPU?): 1.11.0+cu102 (True)
- Tensorflow version (GPU?): 2.7.0 (False)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: <fill in>
- Using distributed or parallel set-up in script?: <fill in>

### Who can help?

@LysandreJik @SaulLu 


### Information

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

### Tasks

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

### Reproduction

step1. 
I downloaded bert-base-cased from https://huggingface.co/models, then I placed all files(config.json  pytorch_model.bin  tokenizer_config.json  tokenizer.json  vocab.txt) in the directory /transformers/examples/pytorch/text-classification/bert-base-cased

step2.
from https://github.com/nyu-mll/GLUE-baselines/download_glue_data.py, I got train.tsv and dev.tsv, then converted them to train.csv and validation.csv(both are three columns, namely label, sentence1, sentence2). I placed these two files in the directory /transformers/examples/pytorch/text-classification/ 

step3. 
python run_glue.py --model_name_or_path bert-base-cased --train_file train.csv --validation_file validation.csv --do_train --do_eval --max_seq_length 128 --per_device_train_batch_size 32 --learning_rate 2e-5 --num_train_epochs 1 --output_dir ./output/


Then I got this error as shown below:

Running tokenizer on dataset:   0%|                                                                             | 0/4 [00:00<?, ?ba/s]
Traceback (most recent call last):
  File "/root/zhaozhifeng/transformers/examples/pytorch/text-classification/run_glue.py", line 613, in <module>
    main()
  File "/root/zhaozhifeng/transformers/examples/pytorch/text-classification/run_glue.py", line 442, in main
    raw_datasets = raw_datasets.map(
  File "/root/anaconda3/lib/python3.9/site-packages/datasets/dataset_dict.py", line 770, in map
    {
  File "/root/anaconda3/lib/python3.9/site-packages/datasets/dataset_dict.py", line 771, in <dictcomp>
    k: dataset.map(
  File "/root/anaconda3/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 2376, in map
    return self._map_single(
  File "/root/anaconda3/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 551, in wrapper
    out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
  File "/root/anaconda3/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 518, in wrapper
    out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
  File "/root/anaconda3/lib/python3.9/site-packages/datasets/fingerprint.py", line 458, in wrapper
    out = func(self, *args, **kwargs)
  File "/root/anaconda3/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 2764, in _map_single
    batch = apply_function_on_filtered_inputs(
  File "/root/anaconda3/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 2644, in apply_function_on_filtered_inputs
    processed_inputs = function(*fn_args, *additional_args, **fn_kwargs)
  File "/root/anaconda3/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 2336, in decorated
    result = f(decorated_item, *args, **kwargs)
  File "/root/zhaozhifeng/transformers/examples/pytorch/text-classification/run_glue.py", line 434, in preprocess_function
    result = tokenizer(*args, padding=padding, max_length=max_seq_length, truncation=True)
  File "/root/anaconda3/lib/python3.9/site-packages/transformers/tokenization_utils_base.py", line 2495, in __call__
    return self.batch_encode_plus(
  File "/root/anaconda3/lib/python3.9/site-packages/transformers/tokenization_utils_base.py", line 2686, in batch_encode_plus
    return self._batch_encode_plus(
  File "/root/anaconda3/lib/python3.9/site-packages/transformers/tokenization_utils_fast.py", line 426, in _batch_encode_plus
    encodings = self._tokenizer.encode_batch(
TypeError: TextInputSequence must be str

### Expected behavior

run run_glue.py and fine-tune on the pre-trained model successfully.

Comments:
What is contained in your CSV files? Would you have a reproducible code example we can run in colab?

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.