Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added gqa as eval dataset #299

Open
wants to merge 4 commits into
base: reduce-scope-mllm
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion open_flamingo/eval/eval_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"okvqa",
"vizwiz",
"textvqa",
"gqa",
"hateful_memes",
"imagenet",
]
Expand Down Expand Up @@ -104,7 +105,7 @@ def get_img_path(self, question):
)
elif self.dataset_name == "vizwiz":
return os.path.join(self.image_dir_path, question["image_id"])
elif self.dataset_name == "textvqa":
elif self.dataset_name == "textvqa" or self.dataset_name == "gqa":
return os.path.join(self.image_dir_path, f"{question['image_id']}.jpg")
else:
raise Exception(f"Unknown VQA dataset {self.dataset_name}")
Expand Down
3 changes: 3 additions & 0 deletions open_flamingo/eval/eval_models/blip.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ def get_vizwiz_prompt(self, question, answer=None) -> str:

def get_textvqa_prompt(self, question, answer=None) -> str:
return f"Question:{question} Short answer:{answer if answer is not None else ''}"

def get_gqa_prompt(self, question, answer=None) -> str:
return f"Question:{question} Short answer:{answer if answer is not None else ''}"

def get_coco_prompt(self, caption=None) -> str:
return f"A photo of {caption if caption is not None else ''}"
Expand Down
3 changes: 3 additions & 0 deletions open_flamingo/eval/eval_models/open_flamingo.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,9 @@ def get_vizwiz_prompt(self, question, answer=None) -> str:

def get_textvqa_prompt(self, question, answer=None) -> str:
return f"<image>Question:{question} Short answer:{answer if answer is not None else ''}{'<|endofchunk|>' if answer is not None else ''}"

def get_gqa_prompt(self, question, answer=None) -> str:
return f"<image>Question:{question} Short answer:{answer if answer is not None else ''}{'<|endofchunk|>' if answer is not None else ''}"

def get_coco_prompt(self, caption=None) -> str:
return f"<image>Output:{caption if caption is not None else ''}{'<|endofchunk|>' if caption is not None else ''}"
Expand Down
Loading
Loading