MathVision_testmini / README.md
muhammad0-0hreden's picture
Upload README.md with huggingface_hub
d875329 verified
|
Raw History Blame Contribute Delete
4.05 kB
metadata
dataset_info:
  features:
    - name: id
      dtype: string
    - name: question
      dtype: string
    - name: options
      list: string
    - name: image
      dtype: string
    - name: decoded_image
      dtype: image
    - name: answer
      dtype: string
    - name: solution
      dtype: string
    - name: level
      dtype: int64
    - name: subject
      dtype: string
    - name: prompt
      dtype: string
  splits:
    - name: testmini
      num_bytes: 5791963
      num_examples: 246
  download_size: 5732057
  dataset_size: 5791963
configs:
  - config_name: default
    data_files:
      - split: testmini
        path: data/testmini-*

MathVision (testmini) – single-image version

This dataset is derived from MathLLMs/MathVision (testmini split only). Please cite and follow the license of the original dataset.

Modifications

  1. Removed multi-image samples: any sample whose question/options reference more than one image (<image1>, <image2>, ...) was deleted. 58 samples were removed, 246 remain.
  2. Added a prompt column, built from the question column:
    • The image tags (<image1>, ...) are removed from the question text.
    • If the sample has choices, they are appended as: QUESTION Choices: (A) option (B) option ...
    • If the choices are only letters (the values are inside the image), the format is: QUESTION Choices: (A) (B) (C) (D) (E)
    • If there are no choices, the prompt is just the cleaned question.

Example

field value
prompt How many different digits can you find in this picture?

Columns

id, question, options, image, decoded_image, answer, solution, level, subject, prompt

Usage

from datasets import load_dataset
ds = load_dataset("Misraj/MathVision_testmini", split="testmini")
print(ds[0]["prompt"])

Scoring

Two files in this repo score model outputs locally (no LLM judge):

File Purpose
mm_scoring.py extract_answer(response, row) pulls the final answer out of a model response (reads \boxed{}, "answer is ...", option letters or option text); is_correct(pred, row) compares it with the gold answer
mathvision_adapt.py prepare_mathvision(row) adds the fields the scorer needs, which this dataset does not store; final_prompt(row) appends an answer-format instruction

prepare_mathvision derives: question_type (multi_choice if options is non-empty, else free_form), answer_type (integer / float / text, from the gold answer), choices, answer_is_letter and precision. When the options are only letters (A-E), the option values are inside the image, so choices are blank and the answer is matched by letter.

Example

from datasets import load_dataset
from huggingface_hub import hf_hub_download
import sys

for f in ["mm_scoring.py", "mathvision_adapt.py"]:
    hf_hub_download("Misraj/MathVision_testmini", f, repo_type="dataset", local_dir=".")
sys.path.insert(0, ".")
from mm_scoring import extract_answer, is_correct
from mathvision_adapt import prepare_mathvision, final_prompt

ds = load_dataset("Misraj/MathVision_testmini", split="testmini")
row = ds[0]
ex = {**row, **prepare_mathvision(row)}

model_input = final_prompt(ex)                 # text prompt to send together with row["image"]
response = "... so the answer is \\boxed{A}"   # your model's output
print(is_correct(extract_answer(response, ex), ex))

Notes

  • Use the same final_prompt for every model you compare; without an explicit format instruction, extraction is less reliable.
  • Multiple choice is scored by letter, integers exactly, floats rounded to the gold precision. Other free-form answers (fractions, expressions, text) are compared as normalized strings, so equivalent forms (0.5 vs 1/2) can count as wrong.
  • Responses cut off at the generation limit have no real final answer. Report how many were cut off next to accuracy.