Cyrile commited on
Commit
1372c18
1 Parent(s): 0a5f2dc

Upload aftdb.py

Browse files
Files changed (1) hide show
  1. aftdb.py +25 -50
aftdb.py CHANGED
@@ -58,7 +58,7 @@ class AFT_Dataset(datasets.GeneratorBasedBuilder):
58
  "Dataset containing scientific article figures associated "
59
  "with their caption, summary, and article title."
60
  ),
61
- data_dir="./{type}",
62
  nb_files_figure=_NB_TAR_FIGURE,
63
  nb_files_table=None
64
  ),
@@ -70,7 +70,7 @@ class AFT_Dataset(datasets.GeneratorBasedBuilder):
70
  "representation of the table, including its caption, summary, "
71
  "and article title."
72
  ),
73
- data_dir="./{type}",
74
  nb_files_figure=None,
75
  nb_files_table=_NB_TAR_TABLE
76
  ),
@@ -82,7 +82,7 @@ class AFT_Dataset(datasets.GeneratorBasedBuilder):
82
  "textual representation of the table, including its caption, "
83
  "summary, and article title."
84
  ),
85
- data_dir="./{type}",
86
  nb_files_figure=_NB_TAR_FIGURE,
87
  nb_files_table=_NB_TAR_TABLE
88
  )
@@ -135,57 +135,32 @@ class AFT_Dataset(datasets.GeneratorBasedBuilder):
135
  data_dir=self.config.data_dir.format(type='table'),
136
  nb_files=self.config.nb_files_table
137
  )
138
- dataset = []
139
  if dl_manager.is_streaming:
140
  downloaded_files = dl_manager.download(all_path)
141
- dataset.append(
142
- datasets.SplitGenerator(
143
- name=datasets.Split.TRAIN,
144
- gen_kwargs={
145
- 'filepaths': [
146
- dl_manager.iter_archive(ii)
147
- for ii in downloaded_files['train']
148
- ],
149
- 'is_streaming': dl_manager.is_streaming
150
- }
151
- )
152
- )
153
- dataset.append(
154
- datasets.SplitGenerator(
155
- name=datasets.Split.TEST,
156
- gen_kwargs={
157
- "filepaths": [
158
- dl_manager.iter_archive(ii)
159
- for ii in downloaded_files['test']
160
- ],
161
- 'is_streaming': dl_manager.is_streaming
162
- }
163
- )
164
- )
165
  else:
166
- dataset.append(
167
- datasets.SplitGenerator(
168
- name=datasets.Split.TRAIN,
169
- gen_kwargs={
170
- 'filepaths': dl_manager.download_and_extract(
171
- all_path['train']
172
- ),
173
- 'is_streaming': dl_manager.is_streaming
174
- }
175
- )
176
- )
177
- dataset.append(
178
- datasets.SplitGenerator(
179
- name=datasets.Split.TEST,
180
- gen_kwargs={
181
- "filepaths": dl_manager.download_and_extract(
182
- all_path['test']
183
- ),
184
- 'is_streaming': dl_manager.is_streaming
185
- }
186
- )
187
  )
188
- return dataset
189
 
190
  def _generate_examples(self, filepaths, is_streaming):
191
  if is_streaming:
 
58
  "Dataset containing scientific article figures associated "
59
  "with their caption, summary, and article title."
60
  ),
61
+ data_dir="./data/arxiv_dataset/{type}", # A modiféer sur Huggingface Hub
62
  nb_files_figure=_NB_TAR_FIGURE,
63
  nb_files_table=None
64
  ),
 
70
  "representation of the table, including its caption, summary, "
71
  "and article title."
72
  ),
73
+ data_dir="./data/arxiv_dataset/{type}", # A modiféer sur Huggingface Hub
74
  nb_files_figure=None,
75
  nb_files_table=_NB_TAR_TABLE
76
  ),
 
82
  "textual representation of the table, including its caption, "
83
  "summary, and article title."
84
  ),
85
+ data_dir="./data/arxiv_dataset/{type}", # A modiféer sur Huggingface Hub
86
  nb_files_figure=_NB_TAR_FIGURE,
87
  nb_files_table=_NB_TAR_TABLE
88
  )
 
135
  data_dir=self.config.data_dir.format(type='table'),
136
  nb_files=self.config.nb_files_table
137
  )
 
138
  if dl_manager.is_streaming:
139
  downloaded_files = dl_manager.download(all_path)
140
+ downloaded_files['train'] = [
141
+ dl_manager.iter_archive(ii) for ii in downloaded_files['train']
142
+ ]
143
+ downloaded_files['test'] = [
144
+ dl_manager.iter_archive(ii) for ii in downloaded_files['test']
145
+ ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  else:
147
+ downloaded_files = dl_manager.download_and_extract(all_path)
148
+ return [
149
+ datasets.SplitGenerator(
150
+ name=datasets.Split.TRAIN,
151
+ gen_kwargs={
152
+ 'filepaths': downloaded_files['train'],
153
+ 'is_streaming': dl_manager.is_streaming
154
+ }
155
+ ),
156
+ datasets.SplitGenerator(
157
+ name=datasets.Split.TEST,
158
+ gen_kwargs={
159
+ "filepaths": downloaded_files['test'],
160
+ 'is_streaming': dl_manager.is_streaming
161
+ }
 
 
 
 
 
 
162
  )
163
+ ]
164
 
165
  def _generate_examples(self, filepaths, is_streaming):
166
  if is_streaming: