The dir name and split strings are confused when loading ArmelR/stack-exchange-instruction dataset
Opened by DongHande (closed)

### Describe the bug

When I load the ArmelR/stack-exchange-instruction dataset, I encounter a bug that may be raised by confusing the dir name string and the split string about the dataset. 

When I use the script "datasets.load_dataset('ArmelR/stack-exchange-instruction', data_dir="data/finetune", split="train", use_auth_token=True)", it fails. But it succeeds when I add the "streaming = True" parameter. 

The website of the dataset is https://huggingface.co/datasets/ArmelR/stack-exchange-instruction/ .

The traceback logs are as below: 

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/xxx/miniconda3/envs/code/lib/python3.9/site-packages/datasets/load.py", line 1797, in load_dataset
    builder_instance.download_and_prepare(
  File "/home/xxx/miniconda3/envs/code/lib/python3.9/site-packages/datasets/builder.py", line 890, in download_and_prepare
    self._download_and_prepare(
  File "/home/xxx/miniconda3/envs/code/lib/python3.9/site-packages/datasets/builder.py", line 985, in _download_and_prepare
    self._prepare_split(split_generator, **prepare_split_kwargs)
  File "/home/xxx/miniconda3/envs/code/lib/python3.9/site-packages/datasets/builder.py", line 1706, in _prepare_split
    split_info = self.info.splits[split_generator.name]
  File "/home/xxx/miniconda3/envs/code/lib/python3.9/site-packages/datasets/splits.py", line 530, in __getitem__
    instructions = make_file_instructions(
  File "/home/xxx/miniconda3/envs/code/lib/python3.9/site-packages/datasets/arrow_reader.py", line 112, in make_file_instructions
    name2filenames = {
  File "/home/xxx/miniconda3/envs/code/lib/python3.9/site-packages/datasets/arrow_reader.py", line 113, in <dictcomp>
    info.name: filenames_for_dataset_split(
  File "/home/xxx/miniconda3/envs/code/lib/python3.9/site-packages/datasets/naming.py", line 70, in filenames_for_dataset_split
    prefix = filename_prefix_for_split(dataset_name, split)
  File "/home/xxx/miniconda3/envs/code/lib/python3.9/site-packages/datasets/naming.py", line 54, in filename_prefix_for_split
    if os.path.basename(name) != name:
  File "/home/xxx/miniconda3/envs/code/lib/python3.9/posixpath.py", line 142, in basename
    p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType





### Steps to reproduce the bug

1. import datasets library function: ```from datasets import load_dataset```
2. load dataset: ```ds=load_dataset('ArmelR/stack-exchange-instruction', data_dir="data/finetune", split="train", use_auth_token=True)```

### Expected behavior

The dataset can be loaded successfully without the streaming setting. 

### Environment info

Linux, 
python=3.9
datasets=2.12.0

Comments:
Thanks for reporting, @DongHande.

I think the issue is caused by the metadata in the dataset card: in the header of the `README.md`, they state that the dataset has 4 splits ("finetune", "reward", "rl", "evaluation"). 
```yaml
  splits:
    - name: finetune
      num_bytes: 6674567576
      num_examples: 3000000
    - name: reward
      num_bytes: 6674341521
      num_examples: 3000000
    - name: rl
      num_bytes: 6679279968
      num_examples: 3000000
    - name: evaluation
      num_bytes: 4022714493
      num_examples: 1807695
```


I guess the user wanted to define these as configs, instead of splits. This is not yet supported for no-script datasets, but will be soon supported. See:
- #5331

I think we should contact the dataset author to inform about the issue with the split names, as you already did: https://huggingface.co/datasets/ArmelR/stack-exchange-instruction/discussions/1
Let's continue the discussion there!

Thank you! It has been fixed.