Datasets:
License:
Upload aftdb.py
Browse files
aftdb.py
CHANGED
|
@@ -26,26 +26,15 @@ _NB_TAR_FIGURE = [158, 4] # train, test
|
|
| 26 |
_NB_TAR_TABLE = [17, 1] # train, test
|
| 27 |
|
| 28 |
|
| 29 |
-
def extract_files_tar(all_path, data_dir, nb_files
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
]
|
| 39 |
-
else:
|
| 40 |
-
paths_train = [
|
| 41 |
-
os.path.join(data_dir, f"train-{ii:03d}.tar")
|
| 42 |
-
for ii in range(nb_files[0])
|
| 43 |
-
]
|
| 44 |
-
paths_test = [
|
| 45 |
-
os.path.join(data_dir, f"test-{ii:03d}.tar")
|
| 46 |
-
for ii in range(nb_files[1])
|
| 47 |
-
]
|
| 48 |
-
print(paths_test)
|
| 49 |
all_path['train'] += paths_train
|
| 50 |
all_path['test'] += paths_test
|
| 51 |
|
|
@@ -69,7 +58,7 @@ class AFT_Dataset(datasets.GeneratorBasedBuilder):
|
|
| 69 |
"Dataset containing scientific article figures associated "
|
| 70 |
"with their caption, summary, and article title."
|
| 71 |
),
|
| 72 |
-
data_dir="./{type}", # A modiféer sur Huggingface Hub
|
| 73 |
nb_files_figure=_NB_TAR_FIGURE,
|
| 74 |
nb_files_table=None
|
| 75 |
),
|
|
@@ -81,7 +70,7 @@ class AFT_Dataset(datasets.GeneratorBasedBuilder):
|
|
| 81 |
"representation of the table, including its caption, summary, "
|
| 82 |
"and article title."
|
| 83 |
),
|
| 84 |
-
data_dir="./{type}", # A modiféer sur Huggingface Hub
|
| 85 |
nb_files_figure=None,
|
| 86 |
nb_files_table=_NB_TAR_TABLE
|
| 87 |
),
|
|
@@ -93,7 +82,7 @@ class AFT_Dataset(datasets.GeneratorBasedBuilder):
|
|
| 93 |
"textual representation of the table, including its caption, "
|
| 94 |
"summary, and article title."
|
| 95 |
),
|
| 96 |
-
data_dir="./{type}", # A modiféer sur Huggingface Hub
|
| 97 |
nb_files_figure=_NB_TAR_FIGURE,
|
| 98 |
nb_files_table=_NB_TAR_TABLE
|
| 99 |
)
|
|
@@ -138,15 +127,13 @@ class AFT_Dataset(datasets.GeneratorBasedBuilder):
|
|
| 138 |
extract_files_tar(
|
| 139 |
all_path=all_path,
|
| 140 |
data_dir=self.config.data_dir.format(type='figure'),
|
| 141 |
-
nb_files=self.config.nb_files_figure
|
| 142 |
-
data_files=self.config.data_files
|
| 143 |
)
|
| 144 |
if self.config.nb_files_table:
|
| 145 |
extract_files_tar(
|
| 146 |
all_path=all_path,
|
| 147 |
data_dir=self.config.data_dir.format(type='table'),
|
| 148 |
-
nb_files=self.config.nb_files_table
|
| 149 |
-
data_files=self.config.data_files
|
| 150 |
)
|
| 151 |
if dl_manager.is_streaming:
|
| 152 |
downloaded_files = dl_manager.download(all_path)
|
|
|
|
| 26 |
_NB_TAR_TABLE = [17, 1] # train, test
|
| 27 |
|
| 28 |
|
| 29 |
+
def extract_files_tar(all_path, data_dir, nb_files):
|
| 30 |
+
paths_train = [
|
| 31 |
+
os.path.join(data_dir, f"train-{ii:03d}.tar")
|
| 32 |
+
for ii in range(nb_files[0])
|
| 33 |
+
]
|
| 34 |
+
paths_test = [
|
| 35 |
+
os.path.join(data_dir, f"test-{ii:03d}.tar")
|
| 36 |
+
for ii in range(nb_files[1])
|
| 37 |
+
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
all_path['train'] += paths_train
|
| 39 |
all_path['test'] += paths_test
|
| 40 |
|
|
|
|
| 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 |
)
|
|
|
|
| 127 |
extract_files_tar(
|
| 128 |
all_path=all_path,
|
| 129 |
data_dir=self.config.data_dir.format(type='figure'),
|
| 130 |
+
nb_files=self.config.nb_files_figure
|
|
|
|
| 131 |
)
|
| 132 |
if self.config.nb_files_table:
|
| 133 |
extract_files_tar(
|
| 134 |
all_path=all_path,
|
| 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)
|