Datasets:
get rid of id files
Browse files- ActivityNet_Captions.py +3 -9
ActivityNet_Captions.py
CHANGED
@@ -71,7 +71,6 @@ class ActivityNet(datasets.GeneratorBasedBuilder):
|
|
71 |
datasets.SplitGenerator(
|
72 |
name=datasets.Split.TRAIN,
|
73 |
gen_kwargs={
|
74 |
-
"ids_file": os.path.join(archive_path, "train_ids.json"),
|
75 |
"infos_file": os.path.join(archive_path, "train.json")
|
76 |
},
|
77 |
)
|
@@ -80,7 +79,6 @@ class ActivityNet(datasets.GeneratorBasedBuilder):
|
|
80 |
datasets.SplitGenerator(
|
81 |
name=datasets.Split.VALIDATION,
|
82 |
gen_kwargs={
|
83 |
-
"ids_file": os.path.join(archive_path, "val_ids.json"),
|
84 |
"infos_file": os.path.join(archive_path, "val_1.json")
|
85 |
},
|
86 |
)
|
@@ -89,22 +87,18 @@ class ActivityNet(datasets.GeneratorBasedBuilder):
|
|
89 |
datasets.SplitGenerator(
|
90 |
name=datasets.Split.TEST,
|
91 |
gen_kwargs={
|
92 |
-
"ids_file": os.path.join(archive_path, "test_ids.json"),
|
93 |
"infos_file": os.path.join(archive_path, "val_2.json")
|
94 |
},
|
95 |
)
|
96 |
]
|
97 |
return train_splits + dev_splits + test_splits
|
98 |
|
99 |
-
def _generate_examples(self,
|
100 |
"""This function returns the examples."""
|
101 |
-
|
102 |
with open(infos_file, encoding="utf-8") as json_file:
|
103 |
infos = json.load(json_file)
|
104 |
-
|
105 |
-
with open(ids_file, encoding="utf-8") as json_file:
|
106 |
-
ids = json.load(json_file)
|
107 |
-
for idx, id in enumerate(ids):
|
108 |
path = "https://www.youtube.com/watch?v=" + id[2:]
|
109 |
starts = [timestamp[0]
|
110 |
for timestamp in infos[id]["timestamps"]]
|
|
|
71 |
datasets.SplitGenerator(
|
72 |
name=datasets.Split.TRAIN,
|
73 |
gen_kwargs={
|
|
|
74 |
"infos_file": os.path.join(archive_path, "train.json")
|
75 |
},
|
76 |
)
|
|
|
79 |
datasets.SplitGenerator(
|
80 |
name=datasets.Split.VALIDATION,
|
81 |
gen_kwargs={
|
|
|
82 |
"infos_file": os.path.join(archive_path, "val_1.json")
|
83 |
},
|
84 |
)
|
|
|
87 |
datasets.SplitGenerator(
|
88 |
name=datasets.Split.TEST,
|
89 |
gen_kwargs={
|
|
|
90 |
"infos_file": os.path.join(archive_path, "val_2.json")
|
91 |
},
|
92 |
)
|
93 |
]
|
94 |
return train_splits + dev_splits + test_splits
|
95 |
|
96 |
+
def _generate_examples(self, infos_file):
|
97 |
"""This function returns the examples."""
|
98 |
+
|
99 |
with open(infos_file, encoding="utf-8") as json_file:
|
100 |
infos = json.load(json_file)
|
101 |
+
for idx, id in enumerate(infos):
|
|
|
|
|
|
|
102 |
path = "https://www.youtube.com/watch?v=" + id[2:]
|
103 |
starts = [timestamp[0]
|
104 |
for timestamp in infos[id]["timestamps"]]
|