Commit
·
c7d8242
1
Parent(s):
fd93420
chore: update builder
Browse files- how2sign-clips.py +12 -11
how2sign-clips.py
CHANGED
|
@@ -96,7 +96,7 @@ class How2SignClips(datasets.GeneratorBasedBuilder):
|
|
| 96 |
|
| 97 |
def _generate_examples(
|
| 98 |
self, metadata_path: str,
|
| 99 |
-
|
| 100 |
) -> tuple[int, dict]:
|
| 101 |
"""
|
| 102 |
Generate examples from metadata.
|
|
@@ -110,16 +110,17 @@ class How2SignClips(datasets.GeneratorBasedBuilder):
|
|
| 110 |
split="train",
|
| 111 |
)
|
| 112 |
for i, sample in enumerate(dataset):
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
|
|
|
| 123 |
|
| 124 |
def __get_binary_data(self, path):
|
| 125 |
with open(path, "rb") as f:
|
|
|
|
| 96 |
|
| 97 |
def _generate_examples(
|
| 98 |
self, metadata_path: str,
|
| 99 |
+
video_dirs: list[str],
|
| 100 |
) -> tuple[int, dict]:
|
| 101 |
"""
|
| 102 |
Generate examples from metadata.
|
|
|
|
| 110 |
split="train",
|
| 111 |
)
|
| 112 |
for i, sample in enumerate(dataset):
|
| 113 |
+
for video_dir in video_dirs:
|
| 114 |
+
video_path = os.path.join(
|
| 115 |
+
video_dir, sample["view"], sample["id"] + ".mp4"
|
| 116 |
+
)
|
| 117 |
+
yield i, {
|
| 118 |
+
"id": sample["id"],
|
| 119 |
+
"type": sample["type"],
|
| 120 |
+
"view": sample["view"],
|
| 121 |
+
"text": sample["text"],
|
| 122 |
+
"video": self.__get_binary_data(video_path),
|
| 123 |
+
}
|
| 124 |
|
| 125 |
def __get_binary_data(self, path):
|
| 126 |
with open(path, "rb") as f:
|