Remove the ans2label mapping
Browse files
gqa.py
CHANGED
|
@@ -39,7 +39,6 @@ _URLS = {
|
|
| 39 |
"train": "https://nlp.cs.unc.edu/data/lxmert_data/gqa/train.json",
|
| 40 |
"dev": "https://nlp.cs.unc.edu/data/lxmert_data/gqa/valid.json",
|
| 41 |
"img": "https://downloads.cs.stanford.edu/nlp/data/gqa/images.zip",
|
| 42 |
-
"ans2label": "https://raw.githubusercontent.com/airsplay/lxmert/master/data/gqa/trainval_ans2label.json",
|
| 43 |
}
|
| 44 |
|
| 45 |
_IMG_DIR = "images"
|
|
@@ -58,7 +57,7 @@ class Gqa(datasets.GeneratorBasedBuilder):
|
|
| 58 |
"question": datasets.Value("string"),
|
| 59 |
"question_id": datasets.Value("int32"),
|
| 60 |
"image_id": datasets.Value("string"),
|
| 61 |
-
"label": datasets.Value("
|
| 62 |
}
|
| 63 |
)
|
| 64 |
return datasets.DatasetInfo(
|
|
@@ -71,7 +70,6 @@ class Gqa(datasets.GeneratorBasedBuilder):
|
|
| 71 |
def _split_generators(self, dl_manager):
|
| 72 |
"""Returns SplitGenerators."""
|
| 73 |
dl_dir = dl_manager.download_and_extract(_URLS)
|
| 74 |
-
self.ans2label = json.load(open(dl_dir["ans2label"]))
|
| 75 |
|
| 76 |
return [
|
| 77 |
datasets.SplitGenerator(
|
|
@@ -90,7 +88,7 @@ class Gqa(datasets.GeneratorBasedBuilder):
|
|
| 90 |
gqa = json.load(f)
|
| 91 |
for id_, d in enumerate(gqa):
|
| 92 |
img_id = os.path.join(img_dir, d["img_id"] + ".jpg")
|
| 93 |
-
label =
|
| 94 |
yield id_, {
|
| 95 |
"question": d["sent"],
|
| 96 |
"question_id": d["question_id"],
|
|
|
|
| 39 |
"train": "https://nlp.cs.unc.edu/data/lxmert_data/gqa/train.json",
|
| 40 |
"dev": "https://nlp.cs.unc.edu/data/lxmert_data/gqa/valid.json",
|
| 41 |
"img": "https://downloads.cs.stanford.edu/nlp/data/gqa/images.zip",
|
|
|
|
| 42 |
}
|
| 43 |
|
| 44 |
_IMG_DIR = "images"
|
|
|
|
| 57 |
"question": datasets.Value("string"),
|
| 58 |
"question_id": datasets.Value("int32"),
|
| 59 |
"image_id": datasets.Value("string"),
|
| 60 |
+
"label": datasets.Value("string"),
|
| 61 |
}
|
| 62 |
)
|
| 63 |
return datasets.DatasetInfo(
|
|
|
|
| 70 |
def _split_generators(self, dl_manager):
|
| 71 |
"""Returns SplitGenerators."""
|
| 72 |
dl_dir = dl_manager.download_and_extract(_URLS)
|
|
|
|
| 73 |
|
| 74 |
return [
|
| 75 |
datasets.SplitGenerator(
|
|
|
|
| 88 |
gqa = json.load(f)
|
| 89 |
for id_, d in enumerate(gqa):
|
| 90 |
img_id = os.path.join(img_dir, d["img_id"] + ".jpg")
|
| 91 |
+
label = next(iter(d["label"]))
|
| 92 |
yield id_, {
|
| 93 |
"question": d["sent"],
|
| 94 |
"question_id": d["question_id"],
|