Datasets:
switch from video_id to video_path
Browse files
TGIF.py
CHANGED
@@ -47,7 +47,7 @@ class TGIF(datasets.GeneratorBasedBuilder):
|
|
47 |
description=_DESCRIPTION,
|
48 |
features=datasets.Features(
|
49 |
{
|
50 |
-
"
|
51 |
"captions": datasets.features.Sequence(datasets.Value("string"))
|
52 |
}
|
53 |
),
|
@@ -102,14 +102,14 @@ class TGIF(datasets.GeneratorBasedBuilder):
|
|
102 |
tsv_file = f.read().decode("utf-8").split("\n")[:-1]
|
103 |
tsv_reader = csv.reader(
|
104 |
tsv_file, delimiter="\t", quotechar='"')
|
105 |
-
for idx, (
|
106 |
try:
|
107 |
-
dict[
|
108 |
except Exception:
|
109 |
pass
|
110 |
|
111 |
-
for idx,
|
112 |
yield idx, {
|
113 |
-
"
|
114 |
-
"captions": dict[
|
115 |
}
|
|
|
47 |
description=_DESCRIPTION,
|
48 |
features=datasets.Features(
|
49 |
{
|
50 |
+
"video_path": datasets.Value("string"),
|
51 |
"captions": datasets.features.Sequence(datasets.Value("string"))
|
52 |
}
|
53 |
),
|
|
|
102 |
tsv_file = f.read().decode("utf-8").split("\n")[:-1]
|
103 |
tsv_reader = csv.reader(
|
104 |
tsv_file, delimiter="\t", quotechar='"')
|
105 |
+
for idx, (video_path, text) in enumerate(tsv_reader):
|
106 |
try:
|
107 |
+
dict[video_path].append(text)
|
108 |
except Exception:
|
109 |
pass
|
110 |
|
111 |
+
for idx, video_path in enumerate(dict):
|
112 |
yield idx, {
|
113 |
+
"video_path": video_path,
|
114 |
+
"captions": dict[video_path],
|
115 |
}
|