Hippolyte GISSEROT-BOUKHLEF commited on
Commit
ee6a688
β€’
1 Parent(s): a620a0e
{subset β†’ data}/.gitattributes RENAMED
File without changes
{subset β†’ data/subset}/split1-0.parquet RENAMED
File without changes
{subset β†’ data/subset}/split1-1.parquet RENAMED
File without changes
{subset β†’ data/subset}/split2-0.parquet RENAMED
File without changes
{subset β†’ data/subset}/split2-1.parquet RENAMED
File without changes
dataset.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import datasets
2
+
3
+ class MyDataset(datasets.GeneratorBasedBuilder):
4
+ # VERSION = datasets.Version("1.0.0")
5
+
6
+ BUILDER_CONFIGS = [
7
+ datasets.BuilderConfig(name="subset1", description="First subset"),
8
+ ]
9
+
10
+ def _split_generators(self, dl_manager):
11
+ import glob
12
+
13
+ data_dir = self.config.data_dir
14
+ return [
15
+ datasets.SplitGenerator(
16
+ name="split1",
17
+ gen_kwargs={"file_paths": sorted(glob.glob(f"{data_dir}/split1-*.parquet"))},
18
+ ),
19
+ datasets.SplitGenerator(
20
+ name="split2",
21
+ gen_kwargs={"file_paths": sorted(glob.glob(f"{data_dir}/split2-*.parquet"))},
22
+ ),
23
+ ]
24
+
25
+ def _generate_examples(self, file_path):
26
+ import pandas as pd
27
+
28
+ df = pd.read_parquet(file_path)
29
+ for idx, row in df.iterrows():
30
+ yield idx, row.to_dict()