Update disrpt.py
Browse files
disrpt.py
CHANGED
@@ -151,9 +151,7 @@ class Dataset(datasets.GeneratorBasedBuilder):
|
|
151 |
|
152 |
def _split_generators(self, dl_manager: datasets.DownloadManager):
|
153 |
cfg_name = self.config.name.rsplit('.', 1)[0]
|
154 |
-
task_type = self.config.name.split('.')[-1]
|
155 |
data_dir = remove_type(self.config.data_dir)
|
156 |
-
print("datadir:",data_dir)
|
157 |
type = self.config.name.split('.')[-1]
|
158 |
urls={k:v for (k,v) in _URLs.items() if cfg_name in k and requests.get(v).status_code!=404}
|
159 |
data_file = dl_manager.download(urls)
|
@@ -161,14 +159,11 @@ class Dataset(datasets.GeneratorBasedBuilder):
|
|
161 |
|
162 |
splits_dict = {datasets.Split.TRAIN: 'train', datasets.Split.VALIDATION: 'dev', datasets.Split.TEST: 'test'}
|
163 |
|
164 |
-
print("data_file:",data_file)
|
165 |
-
print('cfg_name', self.config.name)
|
166 |
split_generators = [
|
167 |
datasets.SplitGenerator(name=split, gen_kwargs={"filepath": data_file[f"{data_dir}-{key}.{type}"]})
|
168 |
for split, key in splits_dict.items()
|
169 |
-
if f"{data_dir}-{key}.{
|
170 |
]
|
171 |
-
print(split_generators)
|
172 |
return split_generators
|
173 |
|
174 |
def _info(self): return datasets.DatasetInfo(
|
|
|
151 |
|
152 |
def _split_generators(self, dl_manager: datasets.DownloadManager):
|
153 |
cfg_name = self.config.name.rsplit('.', 1)[0]
|
|
|
154 |
data_dir = remove_type(self.config.data_dir)
|
|
|
155 |
type = self.config.name.split('.')[-1]
|
156 |
urls={k:v for (k,v) in _URLs.items() if cfg_name in k and requests.get(v).status_code!=404}
|
157 |
data_file = dl_manager.download(urls)
|
|
|
159 |
|
160 |
splits_dict = {datasets.Split.TRAIN: 'train', datasets.Split.VALIDATION: 'dev', datasets.Split.TEST: 'test'}
|
161 |
|
|
|
|
|
162 |
split_generators = [
|
163 |
datasets.SplitGenerator(name=split, gen_kwargs={"filepath": data_file[f"{data_dir}-{key}.{type}"]})
|
164 |
for split, key in splits_dict.items()
|
165 |
+
if f"{data_dir}-{key}.{type}" in data_file
|
166 |
]
|
|
|
167 |
return split_generators
|
168 |
|
169 |
def _info(self): return datasets.DatasetInfo(
|