fix files
Browse files
conceptual_12m_indo.py
CHANGED
|
@@ -15,7 +15,7 @@
|
|
| 15 |
"""Conceptual 12M dataset."""
|
| 16 |
|
| 17 |
import datasets
|
| 18 |
-
import
|
| 19 |
import json
|
| 20 |
|
| 21 |
|
|
@@ -44,7 +44,7 @@ liability for any damages, direct or indirect, resulting from the use of the
|
|
| 44 |
dataset.
|
| 45 |
"""
|
| 46 |
|
| 47 |
-
_URL = "https://huggingface.co/datasets/munggok/CC_12M_Indonesia/resolve/main/data/
|
| 48 |
|
| 49 |
|
| 50 |
class Conceptual12M(datasets.GeneratorBasedBuilder):
|
|
@@ -74,9 +74,9 @@ class Conceptual12M(datasets.GeneratorBasedBuilder):
|
|
| 74 |
|
| 75 |
def _generate_examples(self, file):
|
| 76 |
id_ = 0
|
| 77 |
-
with open(file, "
|
| 78 |
for line in fi:
|
| 79 |
if line:
|
| 80 |
-
example =
|
| 81 |
yield id_, {"image_url": example['url'], "caption": example['caption']}
|
| 82 |
id_ += 1
|
|
|
|
| 15 |
"""Conceptual 12M dataset."""
|
| 16 |
|
| 17 |
import datasets
|
| 18 |
+
import gzip
|
| 19 |
import json
|
| 20 |
|
| 21 |
|
|
|
|
| 44 |
dataset.
|
| 45 |
"""
|
| 46 |
|
| 47 |
+
_URL = "https://huggingface.co/datasets/munggok/CC_12M_Indonesia/resolve/main/data/cc12m_indo.jsonl.gz"
|
| 48 |
|
| 49 |
|
| 50 |
class Conceptual12M(datasets.GeneratorBasedBuilder):
|
|
|
|
| 74 |
|
| 75 |
def _generate_examples(self, file):
|
| 76 |
id_ = 0
|
| 77 |
+
with gzip.open(open(file, "rb"), "rt", encoding="utf-8") as fi:
|
| 78 |
for line in fi:
|
| 79 |
if line:
|
| 80 |
+
example = json.loads(line)
|
| 81 |
yield id_, {"image_url": example['url'], "caption": example['caption']}
|
| 82 |
id_ += 1
|
data/{cc12m.jsonl → cc12m_indo.jsonl.gz}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a6de84cba57774ec9380b73e38037117830ba2cfe7a6d44d253a6d1cc02c61d7
|
| 3 |
+
size 1279405711
|