Skip to content

Commit

Permalink
Merge pull request #56 from gagan3012/main
Browse files Browse the repository at this point in the history
Multilingual LLava bench
  • Loading branch information
Luodian authored May 2, 2024
2 parents bc69a74 + 373265f commit b46239c
Show file tree
Hide file tree
Showing 13 changed files with 641 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
from datasets import load_dataset

# dataset = load_dataset("gagan3012/multilingual-llava-bench")

configs = ['arabic', 'bengali', 'chinese', 'french', 'hindi', 'japanese', 'russian', 'spanish', 'urdu']

for config in configs:
yaml_output = f"""
dataset_path: "gagan3012/multilingual-llava-bench"
dataset_kwargs:
config: {config}
token: True
task: "llava_in_the_wild_{config}"
test_split: train
output_type: generate_until
doc_to_visual: !function utils.llava_doc_to_visual
doc_to_text: !function utils.llava_doc_to_text
doc_to_target: "gpt_answer"
generation_kwargs:
until:
- "ASSISTANT:"
image_aspect_ratio: original
max_new_tokens: 1024
temperature: 0
top_p: 0
num_beams: 1
do_sample: false
process_results: !function utils.llava_process_results
metric_list:
- metric: gpt_eval_llava_all
aggregation: !function utils.llava_all_aggregation
higher_is_better: true
- metric: gpt_eval_llava_conv
aggregation: !function utils.llava_conv_aggregation
higher_is_better: true
- metric: gpt_eval_llava_detail
aggregation: !function utils.llava_detail_aggregation
higher_is_better: true
- metric: gpt_eval_llava_complex
aggregation: !function utils.llava_complex_aggregation
higher_is_better: true
metadata:
version: 0.0
gpt_eval_model_name: "gpt-4-0613"
model_specific_prompt_kwargs:
default:
pre_prompt: ""
post_prompt: ""
"""

with open(f"{config}_llava_in_the_wild.yaml", "w") as f:
f.write(yaml_output)

# Path: _generate_configs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

dataset_path: "gagan3012/multilingual-llava-bench"
dataset_kwargs:
config: arabic
token: True
task: "llava_in_the_wild_arabic"
test_split: train
output_type: generate_until
doc_to_visual: !function utils.llava_doc_to_visual
doc_to_text: !function utils.llava_doc_to_text
doc_to_target: "gpt_answer"
generation_kwargs:
until:
- "ASSISTANT:"
image_aspect_ratio: original
max_new_tokens: 1024
temperature: 0
top_p: 0
num_beams: 1
do_sample: false
process_results: !function utils.llava_process_results
metric_list:
- metric: gpt_eval_llava_all
aggregation: !function utils.llava_all_aggregation
higher_is_better: true
- metric: gpt_eval_llava_conv
aggregation: !function utils.llava_conv_aggregation
higher_is_better: true
- metric: gpt_eval_llava_detail
aggregation: !function utils.llava_detail_aggregation
higher_is_better: true
- metric: gpt_eval_llava_complex
aggregation: !function utils.llava_complex_aggregation
higher_is_better: true
metadata:
version: 0.0
gpt_eval_model_name: "gpt-4-0613"
model_specific_prompt_kwargs:
default:
pre_prompt: ""
post_prompt: ""

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

dataset_path: "gagan3012/multilingual-llava-bench"
dataset_kwargs:
config: bengali
token: True
task: "llava_in_the_wild_bengali"
test_split: train
output_type: generate_until
doc_to_visual: !function utils.llava_doc_to_visual
doc_to_text: !function utils.llava_doc_to_text
doc_to_target: "gpt_answer"
generation_kwargs:
until:
- "ASSISTANT:"
image_aspect_ratio: original
max_new_tokens: 1024
temperature: 0
top_p: 0
num_beams: 1
do_sample: false
process_results: !function utils.llava_process_results
metric_list:
- metric: gpt_eval_llava_all
aggregation: !function utils.llava_all_aggregation
higher_is_better: true
- metric: gpt_eval_llava_conv
aggregation: !function utils.llava_conv_aggregation
higher_is_better: true
- metric: gpt_eval_llava_detail
aggregation: !function utils.llava_detail_aggregation
higher_is_better: true
- metric: gpt_eval_llava_complex
aggregation: !function utils.llava_complex_aggregation
higher_is_better: true
metadata:
version: 0.0
gpt_eval_model_name: "gpt-4-0613"
model_specific_prompt_kwargs:
default:
pre_prompt: ""
post_prompt: ""

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

dataset_path: "gagan3012/multilingual-llava-bench"
dataset_kwargs:
config: chinese
token: True
task: "llava_in_the_wild_chinese"
test_split: train
output_type: generate_until
doc_to_visual: !function utils.llava_doc_to_visual
doc_to_text: !function utils.llava_doc_to_text
doc_to_target: "gpt_answer"
generation_kwargs:
until:
- "ASSISTANT:"
image_aspect_ratio: original
max_new_tokens: 1024
temperature: 0
top_p: 0
num_beams: 1
do_sample: false
process_results: !function utils.llava_process_results
metric_list:
- metric: gpt_eval_llava_all
aggregation: !function utils.llava_all_aggregation
higher_is_better: true
- metric: gpt_eval_llava_conv
aggregation: !function utils.llava_conv_aggregation
higher_is_better: true
- metric: gpt_eval_llava_detail
aggregation: !function utils.llava_detail_aggregation
higher_is_better: true
- metric: gpt_eval_llava_complex
aggregation: !function utils.llava_complex_aggregation
higher_is_better: true
metadata:
version: 0.0
gpt_eval_model_name: "gpt-4-0613"
model_specific_prompt_kwargs:
default:
pre_prompt: ""
post_prompt: ""

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

dataset_path: "gagan3012/multilingual-llava-bench"
dataset_kwargs:
config: french
token: True
task: "llava_in_the_wild_french"
test_split: train
output_type: generate_until
doc_to_visual: !function utils.llava_doc_to_visual
doc_to_text: !function utils.llava_doc_to_text
doc_to_target: "gpt_answer"
generation_kwargs:
until:
- "ASSISTANT:"
image_aspect_ratio: original
max_new_tokens: 1024
temperature: 0
top_p: 0
num_beams: 1
do_sample: false
process_results: !function utils.llava_process_results
metric_list:
- metric: gpt_eval_llava_all
aggregation: !function utils.llava_all_aggregation
higher_is_better: true
- metric: gpt_eval_llava_conv
aggregation: !function utils.llava_conv_aggregation
higher_is_better: true
- metric: gpt_eval_llava_detail
aggregation: !function utils.llava_detail_aggregation
higher_is_better: true
- metric: gpt_eval_llava_complex
aggregation: !function utils.llava_complex_aggregation
higher_is_better: true
metadata:
version: 0.0
gpt_eval_model_name: "gpt-4-0613"
model_specific_prompt_kwargs:
default:
pre_prompt: ""
post_prompt: ""

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

dataset_path: "gagan3012/multilingual-llava-bench"
dataset_kwargs:
config: hindi
token: True
task: "llava_in_the_wild_hindi"
test_split: train
output_type: generate_until
doc_to_visual: !function utils.llava_doc_to_visual
doc_to_text: !function utils.llava_doc_to_text
doc_to_target: "gpt_answer"
generation_kwargs:
until:
- "ASSISTANT:"
image_aspect_ratio: original
max_new_tokens: 1024
temperature: 0
top_p: 0
num_beams: 1
do_sample: false
process_results: !function utils.llava_process_results
metric_list:
- metric: gpt_eval_llava_all
aggregation: !function utils.llava_all_aggregation
higher_is_better: true
- metric: gpt_eval_llava_conv
aggregation: !function utils.llava_conv_aggregation
higher_is_better: true
- metric: gpt_eval_llava_detail
aggregation: !function utils.llava_detail_aggregation
higher_is_better: true
- metric: gpt_eval_llava_complex
aggregation: !function utils.llava_complex_aggregation
higher_is_better: true
metadata:
version: 0.0
gpt_eval_model_name: "gpt-4-0613"
model_specific_prompt_kwargs:
default:
pre_prompt: ""
post_prompt: ""

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

dataset_path: "gagan3012/multilingual-llava-bench"
dataset_kwargs:
config: japanese
token: True
task: "llava_in_the_wild_japanese"
test_split: train
output_type: generate_until
doc_to_visual: !function utils.llava_doc_to_visual
doc_to_text: !function utils.llava_doc_to_text
doc_to_target: "gpt_answer"
generation_kwargs:
until:
- "ASSISTANT:"
image_aspect_ratio: original
max_new_tokens: 1024
temperature: 0
top_p: 0
num_beams: 1
do_sample: false
process_results: !function utils.llava_process_results
metric_list:
- metric: gpt_eval_llava_all
aggregation: !function utils.llava_all_aggregation
higher_is_better: true
- metric: gpt_eval_llava_conv
aggregation: !function utils.llava_conv_aggregation
higher_is_better: true
- metric: gpt_eval_llava_detail
aggregation: !function utils.llava_detail_aggregation
higher_is_better: true
- metric: gpt_eval_llava_complex
aggregation: !function utils.llava_complex_aggregation
higher_is_better: true
metadata:
version: 0.0
gpt_eval_model_name: "gpt-4-0613"
model_specific_prompt_kwargs:
default:
pre_prompt: ""
post_prompt: ""

11 changes: 11 additions & 0 deletions lmms_eval/tasks/multilingual-llava-bench-in-the-wild/rule.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"coding": {"role": "Assistant", "prompt": "Your task is to evaluate the coding abilities of the above two assistants. They have been asked to implement a program to solve a given problem. Please review their code submissions, paying close attention to their problem-solving approach, code structure, readability, and the inclusion of helpful comments.\n\nPlease ensure that the assistants' submissions:\n\n1. Correctly implement the given problem statement.\n2. Contain accurate and efficient code.\n3. Include clear and concise comments that explain the code's logic and functionality.\n4. Adhere to proper coding standards and best practices.\n\nOnce you have carefully reviewed both submissions, provide detailed feedback on their strengths and weaknesses, along with any suggestions for improvement. You should first output a single line containing two scores on the scale of 1-10 (1: no code/no sense; 10: perfect) for Assistant 1 and 2, respectively. Then give extra comments starting from the next line."},
"math": {"role": "Assistant", "prompt": "We would like to request your feedback on the mathematical proficiency of two AI assistants regarding the given user question.\nFirstly, please solve the problem independently, without referring to the answers provided by Assistant 1 and Assistant 2.\nAfterward, please examine the problem-solving process of Assistant 1 and Assistant 2 step-by-step to ensure their correctness, identifying any incorrect steps if present. Your evaluation should take into account not only the answer but also the problem-solving steps.\nFinally, please output a Python tuple containing two numerical scores for Assistant 1 and Assistant 2, ranging from 1 to 10, respectively. If applicable, explain the reasons for any variations in their scores and determine which assistant performed better."},
"default": {"role": "Assistant", "prompt": "We would like to request your feedback on the performance of two AI assistants in response to the user question displayed above.\nPlease rate the helpfulness, relevance, accuracy, level of details of their responses. Each assistant receives an overall score on a scale of 1 to 10, where a higher score indicates better overall performance.\nPlease first output a single line containing only two values indicating the scores for Assistant 1 and 2, respectively. The two scores are separated by a space.\nIn the subsequent line, please provide a comprehensive explanation of your evaluation, avoiding any potential bias and ensuring that the order in which the responses were presented does not affect your judgment."},
"conv": {"role": "Assistant", "prompt": "We would like to request your feedback on the performance of two AI assistants in response to the user question displayed above. The user asks the question on observing an image. For your reference, the visual content in the image is represented with five descriptive sentences describing the same image and the bounding box coordinates of each object in the scene. These coordinates are in the form of bounding boxes, represented as (x1, y1, x2, y2) with floating numbers ranging from 0 to 1. These values correspond to the top left x, top left y, bottom right x, and bottom right y. \nPlease rate the helpfulness, relevance, accuracy, level of details of their responses. Each assistant receives an overall score on a scale of 1 to 10, where a higher score indicates better overall performance.\nPlease first output a single line containing only two values indicating the scores for Assistant 1 and 2, respectively. The two scores are separated by a space.\nIn the subsequent line, please provide a comprehensive explanation of your evaluation, avoiding any potential bias and ensuring that the order in which the responses were presented does not affect your judgment."},
"detail": {"role": "Assistant", "prompt": "We would like to request your feedback on the performance of two AI assistants in response to the user question displayed above. The user asks the question on observing an image. For your reference, the visual content in the image is represented with five descriptive sentences describing the same image and the bounding box coordinates of each object in the scene. These coordinates are in the form of bounding boxes, represented as (x1, y1, x2, y2) with floating numbers ranging from 0 to 1. These values correspond to the top left x, top left y, bottom right x, and bottom right y. \nPlease rate the helpfulness, relevance, accuracy, level of details of their responses. Each assistant receives an overall score on a scale of 1 to 10, where a higher score indicates better overall performance.\nPlease first output a single line containing only two values indicating the scores for Assistant 1 and 2, respectively. The two scores are separated by a space.\nIn the subsequent line, please provide a comprehensive explanation of your evaluation, avoiding any potential bias and ensuring that the order in which the responses were presented does not affect your judgment."},
"complex": {"role": "Assistant", "prompt": "We would like to request your feedback on the performance of two AI assistants in response to the user question displayed above. The user asks the question on observing an image. For your reference, the visual content in the image is represented with five descriptive sentences describing the same image and the bounding box coordinates of each object in the scene. These coordinates are in the form of bounding boxes, represented as (x1, y1, x2, y2) with floating numbers ranging from 0 to 1. These values correspond to the top left x, top left y, bottom right x, and bottom right y. \nPlease rate the helpfulness, relevance, accuracy, level of details of their responses. Each assistant receives an overall score on a scale of 1 to 10, where a higher score indicates better overall performance.\nPlease first output a single line containing only two values indicating the scores for Assistant 1 and 2, respectively. The two scores are separated by a space.\nIn the subsequent line, please provide a comprehensive explanation of your evaluation, avoiding any potential bias and ensuring that the order in which the responses were presented does not affect your judgment."},
"llava_bench_conv": {"role": "Assistant", "prompt": "We would like to request your feedback on the performance of two AI assistants in response to the user question displayed above. The user asks the question on observing an image. For your reference, the visual content in the image is represented with a few sentences describing the image. \nPlease rate the helpfulness, relevance, accuracy, level of details of their responses. Each assistant receives an overall score on a scale of 1 to 10, where a higher score indicates better overall performance.\nPlease first output a single line containing only two values indicating the scores for Assistant 1 and 2, respectively. The two scores are separated by a space.\nIn the subsequent line, please provide a comprehensive explanation of your evaluation, avoiding any potential bias and ensuring that the order in which the responses were presented does not affect your judgment."},
"llava_bench_detail": {"role": "Assistant", "prompt": "We would like to request your feedback on the performance of two AI assistants in response to the user question displayed above. The user asks the question on observing an image. For your reference, the visual content in the image is represented with a few sentences describing the image. \nPlease rate the helpfulness, relevance, accuracy, level of details of their responses. Each assistant receives an overall score on a scale of 1 to 10, where a higher score indicates better overall performance.\nPlease first output a single line containing only two values indicating the scores for Assistant 1 and 2, respectively. The two scores are separated by a space.\nIn the subsequent line, please provide a comprehensive explanation of your evaluation, avoiding any potential bias and ensuring that the order in which the responses were presented does not affect your judgment."},
"llava_bench_complex": {"role": "Assistant", "prompt": "We would like to request your feedback on the performance of two AI assistants in response to the user question displayed above. The user asks the question on observing an image. For your reference, the visual content in the image is represented with a few sentences describing the image. \nPlease rate the helpfulness, relevance, accuracy, level of details of their responses. Each assistant receives an overall score on a scale of 1 to 10, where a higher score indicates better overall performance.\nPlease first output a single line containing only two values indicating the scores for Assistant 1 and 2, respectively. The two scores are separated by a space.\nIn the subsequent line, please provide a comprehensive explanation of your evaluation, avoiding any potential bias and ensuring that the order in which the responses were presented does not affect your judgment."}
}
Loading

0 comments on commit b46239c

Please sign in to comment.