Datasets:
yasumasaonoe
commited on
Commit
•
8c7ccc0
1
Parent(s):
7a52aa8
Update docci.py
Browse files
docci.py
CHANGED
@@ -34,6 +34,7 @@ _URL = "https://storage.googleapis.com/docci/data/"
|
|
34 |
_URLS = {
|
35 |
"descriptions": _URL + "docci_descriptions.jsonlines",
|
36 |
"images": _URL + "docci_images.tar.gz",
|
|
|
37 |
}
|
38 |
|
39 |
_URL_AAR = {
|
@@ -41,19 +42,19 @@ _URL_AAR = {
|
|
41 |
}
|
42 |
|
43 |
_FEATURES_DOCCI = datasets.Features(
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
|
51 |
_FEATURES_DOCCI_AAR = datasets.Features(
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
|
58 |
|
59 |
class DOCCI(datasets.GeneratorBasedBuilder):
|
@@ -106,6 +107,13 @@ class DOCCI(datasets.GeneratorBasedBuilder):
|
|
106 |
return self._generate_examples_docci_aar(data, split)
|
107 |
|
108 |
def _generate_examples_docci(self, data, split):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
with open(data["descriptions"], "r") as f:
|
110 |
examples = [json.loads(l.strip()) for l in f]
|
111 |
|
|
|
34 |
_URLS = {
|
35 |
"descriptions": _URL + "docci_descriptions.jsonlines",
|
36 |
"images": _URL + "docci_images.tar.gz",
|
37 |
+
"metadata": _URL + "docci_metadata.jsonlines"
|
38 |
}
|
39 |
|
40 |
_URL_AAR = {
|
|
|
42 |
}
|
43 |
|
44 |
_FEATURES_DOCCI = datasets.Features(
|
45 |
+
{
|
46 |
+
"image": datasets.Image(),
|
47 |
+
"example_id": datasets.Value('string'),
|
48 |
+
"description": datasets.Value('string'),
|
49 |
+
}
|
50 |
+
)
|
51 |
|
52 |
_FEATURES_DOCCI_AAR = datasets.Features(
|
53 |
+
{
|
54 |
+
"image": datasets.Image(),
|
55 |
+
"example_id": datasets.Value('string'),
|
56 |
+
}
|
57 |
+
)
|
58 |
|
59 |
|
60 |
class DOCCI(datasets.GeneratorBasedBuilder):
|
|
|
107 |
return self._generate_examples_docci_aar(data, split)
|
108 |
|
109 |
def _generate_examples_docci(self, data, split):
|
110 |
+
|
111 |
+
# Load the metadata
|
112 |
+
with open(data["metadata"], "r") as f:
|
113 |
+
metadata = [json.loads(l.strip()) for l in f]
|
114 |
+
metadata_d = { metadata}
|
115 |
+
|
116 |
+
# Load the main data
|
117 |
with open(data["descriptions"], "r") as f:
|
118 |
examples = [json.loads(l.strip()) for l in f]
|
119 |
|