import datasets class MyDataset(datasets.GeneratorBasedBuilder): # VERSION = datasets.Version("1.0.0") BUILDER_CONFIGS = [ datasets.BuilderConfig(name="subset1", description="First subset"), ] def _split_generators(self, dl_manager): import glob data_dir = self.config.data_dir return [ datasets.SplitGenerator( name="split1", gen_kwargs={"file_paths": sorted(glob.glob(f"{data_dir}/split1-*.parquet"))}, ), datasets.SplitGenerator( name="split2", gen_kwargs={"file_paths": sorted(glob.glob(f"{data_dir}/split2-*.parquet"))}, ), ] def _generate_examples(self, file_path): import pandas as pd df = pd.read_parquet(file_path) for idx, row in df.iterrows(): yield idx, row.to_dict()