custom JSON data breaks run_seq2seq.py
Author: varna9000
Pull request: no

## Environment info
- `transformers` version: 4.4.0.dev0
- Platform: Linux-4.19.0-11-amd64-x86_64-with-debian-10.6
- Python version: 3.7.3
- PyTorch version (GPU?): 1.7.1 (True)
- Tensorflow version (GPU?): not installed (NA)
- Using GPU in script?: <fill in>
- Using distributed or parallel set-up in script?: <fill in>

### Who can help
 @sgugger, @patil-suraj

## Information

I'm trying to use mt5 model (but same happens with the example t5-small)

The problem arises when using:
* [ x ] the official example scripts: (give details below)

## To reproduce

When I try to run example/seq2se1/run_seq2seq.py with my own data files, the following error occurs:

```Downloading and preparing dataset json/default-f1b6ef8723ed4d49 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/xxxxxx/.cache/huggingface/datasets/json/default-f1b6ef8723ed4d49/0.0.0/70d89ed4db1394f028c651589fcab6d6b28dddcabbe39d3b21b4d41f9a708514...
Traceback (most recent call last):
  File "/home/xxxxx/.cache/huggingface/modules/datasets_modules/datasets/json/70d89ed4db1394f028c651589fcab6d6b28dddcabbe39d3b21b4d41f9a708514/json.py", line 82, in _generate_tables
    parse_options=self.config.pa_parse_options,
  File "pyarrow/_json.pyx", line 247, in pyarrow._json.read_json
  File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
  File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: JSON parse error: Column() changed from object to array in row 0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "examples/seq2seq/run_seq2seq.py", line 537, in <module>
    main()
  File "examples/seq2seq/run_seq2seq.py", line 287, in main
    datasets = load_dataset(extension, data_files=data_files)
  File "/home/xxxxx/.local/lib/python3.7/site-packages/datasets/load.py", line 612, in load_dataset
    ignore_verifications=ignore_verifications,
  File "/home/xxxxx/.local/lib/python3.7/site-packages/datasets/builder.py", line 527, in download_and_prepare
    dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs
  File "/home/xxxxx/.local/lib/python3.7/site-packages/datasets/builder.py", line 604, in _download_and_prepare
    self._prepare_split(split_generator, **prepare_split_kwargs)
  File "/home/xxxx/.local/lib/python3.7/site-packages/datasets/builder.py", line 959, in _prepare_split
    for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
  File "/home/xxxx/.local/lib/python3.7/site-packages/tqdm/std.py", line 1166, in __iter__
    for obj in iterable:
  File "/home/xxxxxxxx/.cache/huggingface/modules/datasets_modules/datasets/json/70d89ed4db1394f028c651589fcab6d6b28dddcabbe39d3b21b4d41f9a708514/json.py", line 88, in _generate_tables
    f"Not able to read records in the JSON file at {file}. "
AttributeError: 'list' object has no attribute 'keys'
```

I'm using the following json format:
```
[
  {
  "title": "summarised text",
   "body": "text to be summarized"
  },
{
   "title": "summarised text",
   "body": "text to be summarized"
  }
]
```

I pass the --text_column body --summary_column title to the script and I can't understand why it's breaking.



Comments:
Hi @varna9000 

The script expects jsonline format where each line is a `json` object. for ex:
```
{"title": "summarised text","body": "text to be summarized"}
{"title": "summarised text","body": "text to be summarized"}
```

You can find more info in the `datasets` doc here https://huggingface.co/docs/datasets/loading_datasets.html#json-files

Thank you!  :)

Hi, I somehow encountered the same problem. Can I ask you how did you solve it?

> Hi, I somehow encountered the same problem. Can I ask you how did you solve it?

Encountered too.

@judy-jii @hihihihiwsf it has been answered. You have to pass jsonlines format, not json.

For anyone else who gets here from google, make sure your JSON lines are not wrapped in quote marks or something similar. Each line should be a valid JSON object, not a string.