enoriega commited on
Commit
8d9d564
1 Parent(s): 5909dd4

Upload odinsynth_dataset.py

Browse files
Files changed (1) hide show
  1. odinsynth_dataset.py +8 -5
odinsynth_dataset.py CHANGED
@@ -91,14 +91,17 @@ class OdinsynthDatasetBuilder(datasets.GeneratorBasedBuilder):
91
  # If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
92
 
93
  JSON_PATH = dl_manager.download_and_extract('merged_train_split_train.jsonl.gz')
94
- ARCHIVE_PATH = dl_manager.download('data.tar.bz2')
 
 
 
95
  specs = self._build_specs(JSON_PATH)
96
  return [
97
  datasets.SplitGenerator(
98
  name=datasets.Split.TRAIN,
99
  # These kwargs will be passed to _generate_examples
100
  gen_kwargs={
101
- "archive_iter": dl_manager.iter_archive(ARCHIVE_PATH),
102
  "specs": specs,
103
  "split": "train",
104
  },
@@ -107,7 +110,7 @@ class OdinsynthDatasetBuilder(datasets.GeneratorBasedBuilder):
107
  name=datasets.Split.TEST,
108
  # These kwargs will be passed to _generate_examples
109
  gen_kwargs={
110
- "archive_iter": dl_manager.iter_archive(ARCHIVE_PATH),
111
  "specs": specs,
112
  "split": "test",
113
  },
@@ -116,7 +119,7 @@ class OdinsynthDatasetBuilder(datasets.GeneratorBasedBuilder):
116
  name=datasets.Split.VALIDATION,
117
  # These kwargs will be passed to _generate_examples
118
  gen_kwargs={
119
- "archive_iter": dl_manager.iter_archive(ARCHIVE_PATH),
120
  "specs": specs,
121
  "split": "val",
122
  },
@@ -129,7 +132,7 @@ class OdinsynthDatasetBuilder(datasets.GeneratorBasedBuilder):
129
 
130
  key = 0
131
  for tsv_path, file in archive_iter:
132
- if tsv_path.startswith(split) and tsv_path.endswith(".tsv"):
133
  # Read the lines
134
  reader = csv.reader((l.decode() for l in file), delimiter='\t')
135
  for row in reader:
 
91
  # If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
92
 
93
  JSON_PATH = dl_manager.download_and_extract('merged_train_split_train.jsonl.gz')
94
+ TRAIN_ARCHIVE_PATH = dl_manager.download('train.tar.bz2')
95
+ VAL_ARCHIVE_PATH = dl_manager.download('val.tar.bz2')
96
+ TEST_ARCHIVE_PATH = dl_manager.download('test.tar.bz2')
97
+
98
  specs = self._build_specs(JSON_PATH)
99
  return [
100
  datasets.SplitGenerator(
101
  name=datasets.Split.TRAIN,
102
  # These kwargs will be passed to _generate_examples
103
  gen_kwargs={
104
+ "archive_iter": dl_manager.iter_archive(TRAIN_ARCHIVE_PATH),
105
  "specs": specs,
106
  "split": "train",
107
  },
 
110
  name=datasets.Split.TEST,
111
  # These kwargs will be passed to _generate_examples
112
  gen_kwargs={
113
+ "archive_iter": dl_manager.iter_archive(TEST_ARCHIVE_PATH),
114
  "specs": specs,
115
  "split": "test",
116
  },
 
119
  name=datasets.Split.VALIDATION,
120
  # These kwargs will be passed to _generate_examples
121
  gen_kwargs={
122
+ "archive_iter": dl_manager.iter_archive(VAL_ARCHIVE_PATH),
123
  "specs": specs,
124
  "split": "val",
125
  },
 
132
 
133
  key = 0
134
  for tsv_path, file in archive_iter:
135
+ if tsv_path.endswith(".tsv"):
136
  # Read the lines
137
  reader = csv.reader((l.decode() for l in file), delimiter='\t')
138
  for row in reader: