ValueError when a split is empty
{'login': 'jplu', 'id': 959590, 'node_id': 'MDQ6VXNlcjk1OTU5MA==', 'avatar_url': 'https://avatars.githubusercontent.com/u/959590?v=4', 'gravatar_id': '', 'url': 'https://api.github.com/users/jplu', 'html_url': 'https://github.com/jplu', 'followers_url': 'https://api.github.com/users/jplu/followers', 'following_url': 'https://api.github.com/users/jplu/following{/other_user}', 'gists_url': 'https://api.github.com/users/jplu/gists{/gist_id}', 'starred_url': 'https://api.github.com/users/jplu/starred{/owner}{/repo}', 'subscriptions_url': 'https://api.github.com/users/jplu/subscriptions', 'organizations_url': 'https://api.github.com/users/jplu/orgs', 'repos_url': 'https://api.github.com/users/jplu/repos', 'events_url': 'https://api.github.com/users/jplu/events{/privacy}', 'received_events_url': 'https://api.github.com/users/jplu/received_events', 'type': 'User', 'site_admin': False}
[]
[]
['To fix this I propose to modify only the file `arrow_reader.py` with few updates. First update, the following method:\r\n```python\r\ndef _make_file_instructions_from_absolutes(\r\n        name,\r\n        name2len,\r\n        absolute_instructions,\r\n):\r\n    """Returns the files instructions from the absolute instructions list."""\r\n    # For each split, return the files instruction (skip/take)\r\n    file_instructions = []\r\n    num_examples = 0\r\n    for abs_instr in absolute_instructions:\r\n        length = name2len[abs_instr.splitname]\r\n        if not length:\r\n            raise ValueError(\r\n                    \'Split empty. This might means that dataset hasn\\\'t been generated \'\r\n                    \'yet and info not restored from GCS, or that legacy dataset is used.\')\r\n        filename = filename_for_dataset_split(\r\n                dataset_name=name,\r\n                split=abs_instr.splitname,\r\n                filetype_suffix=\'arrow\')\r\n        from_ = 0 if abs_instr.from_ is None else abs_instr.from_\r\n        to = length if abs_instr.to is None else abs_instr.to\r\n        num_examples += to - from_\r\n        single_file_instructions = [{"filename": filename, "skip": from_, "take": to - from_}]\r\n        file_instructions.extend(single_file_instructions)\r\n    return FileInstructions(\r\n            num_examples=num_examples,\r\n            file_instructions=file_instructions,\r\n    )\r\n```\r\nBecomes:\r\n```python\r\ndef _make_file_instructions_from_absolutes(\r\n        name,\r\n        name2len,\r\n        absolute_instructions,\r\n):\r\n    """Returns the files instructions from the absolute instructions list."""\r\n    # For each split, return the files instruction (skip/take)\r\n    file_instructions = []\r\n    num_examples = 0\r\n    for abs_instr in absolute_instructions:\r\n        length = name2len[abs_instr.splitname]\r\n        ## Delete the if not length and the raise\r\n        filename = filename_for_dataset_split(\r\n                dataset_name=name,\r\n                split=abs_instr.splitname,\r\n                filetype_suffix=\'arrow\')\r\n        from_ = 0 if abs_instr.from_ is None else abs_instr.from_\r\n        to = length if abs_instr.to is None else abs_instr.to\r\n        num_examples += to - from_\r\n        single_file_instructions = [{"filename": filename, "skip": from_, "take": to - from_}]\r\n        file_instructions.extend(single_file_instructions)\r\n    return FileInstructions(\r\n            num_examples=num_examples,\r\n            file_instructions=file_instructions,\r\n    )\r\n```\r\n\r\nSecond update the following method:\r\n```python\r\ndef _read_files(files, info):\r\n    """Returns Dataset for given file instructions.\r\n\r\n    Args:\r\n        files: List[dict(filename, skip, take)], the files information.\r\n            The filenames contain the absolute path, not relative.\r\n            skip/take indicates which example read in the file: `ds.slice(skip, take)`\r\n    """\r\n    pa_batches = []\r\n    for f_dict in files:\r\n        pa_table: pa.Table = _get_dataset_from_filename(f_dict)\r\n        pa_batches.extend(pa_table.to_batches())\r\n    pa_table = pa.Table.from_batches(pa_batches)\r\n    ds = Dataset(arrow_table=pa_table, data_files=files, info=info)\r\n    return ds\r\n```\r\nBecomes:\r\n```python\r\ndef _read_files(files, info):\r\n    """Returns Dataset for given file instructions.\r\n\r\n    Args:\r\n        files: List[dict(filename, skip, take)], the files information.\r\n            The filenames contain the absolute path, not relative.\r\n            skip/take indicates which example read in the file: `ds.slice(skip, take)`\r\n    """\r\n    pa_batches = []\r\n    for f_dict in files:\r\n        pa_table: pa.Table = _get_dataset_from_filename(f_dict)\r\n        pa_batches.extend(pa_table.to_batches())\r\n    ## we modify the table only if there are some batches\r\n    if pa_batches:\r\n        pa_table = pa.Table.from_batches(pa_batches)\r\n    ds = Dataset(arrow_table=pa_table, data_files=files, info=info)\r\n    return ds\r\n```\r\n\r\nWith these two updates it works now. @thomwolf are you ok with this changes?'
 'Yes sounds good to me!\r\nDo you want to make a PR? or I can do it as well'
 'Fixed.']
When a split is empty either TEST, VALIDATION or TRAIN I get the following error:
```
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jplu/dev/jplu/datasets/src/nlp/load.py", line 295, in load
    ds = dbuilder.as_dataset(**as_dataset_kwargs)
  File "/home/jplu/dev/jplu/datasets/src/nlp/builder.py", line 587, in as_dataset
    datasets = utils.map_nested(build_single_dataset, split, map_tuple=True)
  File "/home/jplu/dev/jplu/datasets/src/nlp/utils/py_utils.py", line 158, in map_nested
    for k, v in data_struct.items()
  File "/home/jplu/dev/jplu/datasets/src/nlp/utils/py_utils.py", line 158, in <dictcomp>
    for k, v in data_struct.items()
  File "/home/jplu/dev/jplu/datasets/src/nlp/utils/py_utils.py", line 172, in map_nested
    return function(data_struct)
  File "/home/jplu/dev/jplu/datasets/src/nlp/builder.py", line 601, in _build_single_dataset
    split=split,
  File "/home/jplu/dev/jplu/datasets/src/nlp/builder.py", line 625, in _as_dataset
    split_infos=self.info.splits.values(),
  File "/home/jplu/dev/jplu/datasets/src/nlp/arrow_reader.py", line 200, in read
    return py_utils.map_nested(_read_instruction_to_ds, instructions)
  File "/home/jplu/dev/jplu/datasets/src/nlp/utils/py_utils.py", line 172, in map_nested
    return function(data_struct)
  File "/home/jplu/dev/jplu/datasets/src/nlp/arrow_reader.py", line 191, in _read_instruction_to_ds
    file_instructions = make_file_instructions(name, split_infos, instruction)
  File "/home/jplu/dev/jplu/datasets/src/nlp/arrow_reader.py", line 104, in make_file_instructions
    absolute_instructions=absolute_instructions,
  File "/home/jplu/dev/jplu/datasets/src/nlp/arrow_reader.py", line 122, in _make_file_instructions_from_absolutes
    'Split empty. This might means that dataset hasn\'t been generated '
ValueError: Split empty. This might means that dataset hasn't been generated yet and info not restored from GCS, or that legacy dataset is used.
``` 

How to reproduce:
```python
import csv

import nlp


class Bbc(nlp.GeneratorBasedBuilder):
    VERSION = nlp.Version("1.0.0")

    def __init__(self, **config):
        self.train = config.pop("train", None)
        self.validation = config.pop("validation", None)
        super(Bbc, self).__init__(**config)

    def _info(self):
        return nlp.DatasetInfo(builder=self, description="bla", features=nlp.features.FeaturesDict({"id": nlp.int32, "text": nlp.string, "label": nlp.string}))

    def _split_generators(self, dl_manager):
        return [nlp.SplitGenerator(name=nlp.Split.TRAIN, gen_kwargs={"filepath": self.train}),
                nlp.SplitGenerator(name=nlp.Split.VALIDATION, gen_kwargs={"filepath": self.validation}),
                nlp.SplitGenerator(name=nlp.Split.TEST, gen_kwargs={"filepath": None})]

    def _generate_examples(self, filepath):
        if not filepath:
            return None, {}

        with open(filepath) as f:
            reader = csv.reader(f, delimiter=',', quotechar="\"")
            lines = list(reader)[1:]

            for idx, line in enumerate(lines):
                yield idx, {"id": idx, "text": line[1], "label": line[0]}
```

```python
import nlp
dataset = nlp.load("bbc", builder_kwargs={"train": "bbc/data/train.csv", "validation": "bbc/data/test.csv"})
```
{'url': 'https://api.github.com/repos/huggingface/datasets/issues/5/reactions', 'total_count': 0, '+1': 0, '-1': 0, 'laugh': 0, 'hooray': 0, 'confused': 0, 'heart': 0, 'rocket': 0, 'eyes': 0}