Skip to content

from_generator does not allow to specify the split name #7033

@pminervini

Description

@pminervini

Describe the bug

I'm building train, dev, and test using from_generator; however, in all three cases, the logger prints Generating train split:
It's not possible to change the split name since it seems to be hardcoded: https://github.com/huggingface/datasets/blob/main/src/datasets/packaged_modules/generator/generator.py

Steps to reproduce the bug

In [1]: from datasets import Dataset

In [2]: def gen():
   ...:     yield {"pokemon": "bulbasaur", "type": "grass"}
   ...: 

In [3]: ds = Dataset.from_generator(gen)
Generating train split: 1 examples [00:00, 133.89 examples/s]

Expected behavior

It should be possible to specify any split name

Environment info

  • datasets version: 2.19.2
  • Platform: macOS-10.16-x86_64-i386-64bit
  • Python version: 3.8.5
  • huggingface_hub version: 0.23.3
  • PyArrow version: 15.0.0
  • Pandas version: 2.0.3
  • fsspec version: 2023.10.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions