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

MixEval-X Image / Video #434

Merged
merged 10 commits into from
Dec 3, 2024
Prev Previous commit
Next Next commit
video2text fix
  • Loading branch information
pufanyi committed Nov 30, 2024
commit 715df25ce4463381f4881a728f0bb6f583fbedd2
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
dataset_name: "video2text_closeended_free-form"
task: "mix_evals_video2text_freeform"
test_split: test
dataset_name: "video2text"
test_split: free_form
output_type: generate_until
doc_to_visual: !function utils.mix_evals_video2text_doc_to_visual
doc_to_text: !function utils.mix_evals_video2text_doc_to_text
doc_to_target: "{{target}}"
doc_to_target: "{{reference_answer}}"
process_results: !function utils.mix_evals_video2text_process_results_freeform
metric_list:
- metric: gpt_eval
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
include: _default_template_yaml
dataset_name: "video2text_closeended_multiple-choice"
task: "mix_evals_video2text_mc"
test_split: test
dataset_name: "video2text"
test_split: multiple_choice
output_type: generate_until
doc_to_visual: !function utils.mix_evals_video2text_doc_to_visual
doc_to_text: !function utils.mix_evals_video2text_doc_to_text
doc_to_target: "{{target}}"
doc_to_target: "{{reference_answer}}"

generation_kwargs:
max_new_tokens: 5
Expand Down
6 changes: 3 additions & 3 deletions lmms_eval/tasks/mix_evals/video2text/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,13 @@ def mix_evals_video2text_process_results_open_convs(doc, result):

def mix_evals_video2text_process_results_freeform(doc, result):
pred = result[0]
ground_truth_str = ", ".join([f'"{gt}"' for gt in doc["target"]])
ground_truth_str = ", ".join([f'"{gt}"' for gt in doc["reference_answer"]])
ground_truth_str = f"[{ground_truth_str}]"
content = eval_prompt.format(model_response=pred, ground_truth=ground_truth_str)
eval_answer, model_name = get_eval(model_response=pred, ground_truth=ground_truth_str, max_tokens=1024)
return {
"submission": {"pred": pred, "question_idx": doc["question_index"], "target": doc["target"], "eval_answer": eval_answer, "gpt_prompt": content},
"gpt_eval": {"pred": pred, "question_idx": doc["question_index"], "target": doc["target"], "eval_answer": eval_answer, "gpt_prompt": content},
"submission": {"pred": pred, "question_idx": doc["id"], "target": doc["reference_answer"], "eval_answer": eval_answer, "gpt_prompt": content},
"gpt_eval": {"pred": pred, "question_idx": doc["id"], "target": doc["reference_answer"], "eval_answer": eval_answer, "gpt_prompt": content},
}


Expand Down