Dataset Viewer
Auto-converted to Parquet Duplicate
question_text
stringlengths
5
906
background_description
sequencelengths
0
3
answer_text
stringclasses
6 values
options
sequencelengths
2
6
need_image
stringclasses
1 value
language
stringclasses
1 value
level
stringclasses
3 values
subject
stringclasses
2 values
subject_category
stringclasses
2 values
year
stringclasses
9 values
image_ids
sequencelengths
0
6
images
listlengths
0
6
Considerato un parallelogramma $ABCD$, le rette parallele ai lati passanti per un punto interno $P$ intersecano i lati in $A'$, $B'$, $C'$ e $D'$, come in figura. I perimetri (in metri) dei parallelogrammi $D'AA'P$, $C'DD'P$ e $B'CC'P$ sono quelli indicati in figura. Quanti metri misura il perimetro del parallelogramma...
[]
A
[ "(A) 24", "(B) 22", "(C) 26", "(D) 28", "(E) 27" ]
yes
italian
high
math
math
2022
[ "image-0.jpg" ]
[ { "bytes": [ 137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 1, 12, 0, 0, 0, 223, 8, 2, 0, 0, 0, 140, 51, ...
Nel triangolo acutangolo $ABC$, i lati $AB$ e $BC$ misurano 17 m e 25 m, l'altezza $BH$ misura 15 m. Consideriamo il triangolo $A'B'C'$, contenuto in $ABC$, i cui lati sono paralleli a quelli di $ABC$ e si trovano a 2 m di distanza da questi. Quanti m^2 misura l'area di $A'B'C'$? (image)[image-1.jpg]
[]
B
[ "(A) 315/2", "(B) 280/3", "(C) 140", "(D) 105", "(E) 126" ]
yes
italian
high
math
math
2022
[ "image-1.jpg" ]
[ { "bytes": [ 137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 1, 102, 0, 0, 0, 190, 8, 2, 0, 0, 0, 137, 94,...
Nel mese di Settembre 2010 ci sono stati più giorni di pioggia che nel mese di Settembre 2011
[ "Osserva il grafico che riporta alcuni dati raccolti dalla stazione meteorologica di Udine. \n(image)[image-2.png]", "Sulla base dei dati riportati nel grafico indica se ciascuna delle seguenti affermazioni è vera (V) o falsa (F)." ]
A
[ "A. V", "B. F" ]
yes
italian
high
math
math
2014
[ "image-2.png" ]
[ { "bytes": [ 137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 2, 245, 0, 0, 1, 172, 8, 2, 0, 0, 0, 210, 73,...
Nel periodo 2001-2011, Aprile è stato il mese con il maggior numero medio di giorni di pioggia
[ "Osserva il grafico che riporta alcuni dati raccolti dalla stazione meteorologica di Udine. \n(image)[image-2.png]", "Sulla base dei dati riportati nel grafico indica se ciascuna delle seguenti affermazioni è vera (V) o falsa (F)." ]
B
[ "A. V", "B. F" ]
yes
italian
high
math
math
2014
[ "image-2.png" ]
[ { "bytes": [ 137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 2, 245, 0, 0, 1, 172, 8, 2, 0, 0, 0, 210, 73,...
Nel 2010, Giugno è stato il mese con il minor numero di giorni di pioggia
[ "Osserva il grafico che riporta alcuni dati raccolti dalla stazione meteorologica di Udine. \n(image)[image-2.png]", "Sulla base dei dati riportati nel grafico indica se ciascuna delle seguenti affermazioni è vera (V) o falsa (F)." ]
A
[ "A. V", "B. F" ]
yes
italian
high
math
math
2014
[ "image-2.png" ]
[ { "bytes": [ 137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 2, 245, 0, 0, 1, 172, 8, 2, 0, 0, 0, 210, 73,...
Nei mesi di Maggio e Giugno 2010 sono caduti complessivamente circa 500 mm di pioggia
[ "Osserva il grafico che riporta alcuni dati raccolti dalla stazione meteorologica di Udine. \n(image)[image-2.png]", "La figura seguente mostra la precipitazione mensile <u>cumulata</u> del 2010 e del 2011. Per esempio, come si vede, a Udine, nel 2010, dall'inizio dell'anno fino ad Aprile sono caduti all'incirca ...
A
[ "A. V", "B. F" ]
yes
italian
high
math
math
2014
[ "image-2.png", "image-3.png" ]
[ { "bytes": [ 137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 2, 245, 0, 0, 1, 172, 8, 2, 0, 0, 0, 210, 73,...
"Da Aprile in poi la precipitazione mensile cumulata del 2010 è stata maggiore della precipitazione(...TRUNCATED)
["Osserva il grafico che riporta alcuni dati raccolti dalla stazione meteorologica di Udine. \n(imag(...TRUNCATED)
A
[ "A. V", "B. F" ]
yes
italian
high
math
math
2014
[ "image-2.png", "image-3.png" ]
[{"bytes":"iVBORw0KGgoAAAANSUhEUgAAAvUAAAGsCAIAAADSSc94AAAsO0lEQVR4nO3dPWhlZ34/8HP/LAMOIZitvS69TSCZQ(...TRUNCATED)
"Sia nel 2010 sia nel 2011, a partire da Gennaio ogni mese è piovuto sempre di più fino ad avere u(...TRUNCATED)
["Osserva il grafico che riporta alcuni dati raccolti dalla stazione meteorologica di Udine. \n(imag(...TRUNCATED)
B
[ "A. V", "B. F" ]
yes
italian
high
math
math
2014
[ "image-2.png", "image-3.png" ]
[{"bytes":"iVBORw0KGgoAAAANSUhEUgAAAvUAAAGsCAIAAADSSc94AAAsO0lEQVR4nO3dPWhlZ34/8HP/LAMOIZitvS69TSCZQ(...TRUNCATED)
"Un capitano vede dalla sua nave che il faro A sulla costa si trova esattamente in direzione Nord-Es(...TRUNCATED)
[]
C
["A. 13 miglia nautiche","B. Dalle 9 alle 10 miglia nautiche","C. Dalle 10 alle 11 miglia nautiche",(...TRUNCATED)
yes
italian
high
math
math
2014
[ "image-4.png" ]
[{"bytes":"iVBORw0KGgoAAAANSUhEUgAAAp0AAAHGCAIAAAC5FqfAAAAwIUlEQVR4nO3de1yUdaLH8YfNsMdLxx3MLAYxyVHMD(...TRUNCATED)
"Per frequentare una palestra Paolo deve pagare quest'anno una quota fissa di 60 euro e 5 euro per o(...TRUNCATED)
[]
D
[ "A. Grafico 1", "B. Grafico 2", "C. Grafico 3", "D. Grafico 4" ]
yes
italian
high
math
math
2014
[ "image-5.png" ]
[{"bytes":"iVBORw0KGgoAAAANSUhEUgAAAtwAAAHGCAIAAADIbsteAABqa0lEQVR4nO3dd0AUZ/4/8Gdm+y7ssvTeO4iKYm9gL(...TRUNCATED)
End of preview. Expand in Data Studio

Multi-Modal M3Exam

Note that this is a copy from https://github.com/DAMO-NLP-SG/M3Exam, which includes ONLY the multi-modal questions!

It was created due to issues in the original repo and to ease access. It also includes the image features and has a uniform and joined structure.

If you use this dataset, please cite the original authors:

@article{zhang2023m3exam,
    title={M3Exam: A Multilingual, Multimodal, Multilevel Benchmark for Examining Large Language Models},
    author={Wenxuan Zhang and Sharifah Mahani Aljunied and Chang Gao and Yew Ken Chia and Lidong Bing},
    year={2023},
    eprint={2306.05179},
    archivePrefix={arXiv},
    primaryClass={cs.CL}
}

How to load the image features

Due to a bug, the images cannot be stored as PIL.Image.Images directly but need to be converted to dataset.Images-. Hence, to load them, this additional step is required:

from datasets import Image, load_dataset

ds = load_dataset("floschne/multimodal-m3exam", split="english")
ds.map(
    lambda sample: {
        "images_t": [Image().decode_example(img) for img in sample["images"]]
    },
    remove_columns=["images"],
).rename_column("images_t", "images")
Show the code used to generate this dataset. This assumes that the directory `m3exam/multimodal-question/` exists and is an exact copy from the original GitHub repository.
import pandas as pd
from pathlib import Path
from datasets import Image, DatasetDict, Dataset, Value, Sequence
from PIL import Image as PILImage
from tqdm.auto import tqdm
from copy import deepcopy
from functools import partial
import re

tqdm.pandas()

def get_img_ids(row, img_base_p):
  p = r"\(image\)\[image-.*\..*\]"
  imgs = re.findall(p, row["question_text"])
  for option in row["options"]:
      imgs.extend(re.findall(p, option))
  for bgdesc in row["background_description"]:
      imgs.extend(re.findall(p, bgdesc))

  img_ids = [img.split("[")[1].split("]")[0] for img in imgs]
  # remove the last character if it is a period (eg. image-1.png. -> image-1.png)
  img_ids = [img_id[:-1] if img_id[-1] == "." else img_id for img_id in img_ids]
  # remove character after the last digit (eg. image-13c.png -> image-13.png)
  img_ids = [re.sub(r"\D*\.", ".", img_id) for img_id in img_ids]
  # remove character between dots (eg. image-13.c.png -> image-13.png)
  img_ids = [re.sub(r"\.\D*\.", ".", img_id) for img_id in img_ids]

  for img_id in img_ids:
      if not (img_base_p / img_id).exists():
          # print(f"MISSING IMAGE: {img_id=}, {imgs=}, {row.name=}")
          return None
  return img_ids

def load_images(img_ids, img_base_p):
  if img_ids is None:
      return None
  img = Image()
  return [
      img.encode_example(deepcopy(PILImage.open(img_base_p / img_id).convert("RGB")))
      for img_id in img_ids
  ]

if __name__ == "__main__":
  dsd = DatasetDict()
  img_base_p = "m3exam/multimodal-question/images-"
  for p in (
      pbar := tqdm(
          list(Path("m3exam/multimodal-question").glob("*-questions-image.json"))
      )
  ):
      lang = p.stem.split("-")[0]
      pbar.set_description(lang)
  
      df = pd.read_json(p)
      df["image_ids"] = df.apply(
          partial(get_img_ids, img_base_p=Path(img_base_p + lang)), axis=1
      )
      df["images"] = df["image_ids"].progress_apply(
          partial(load_images, img_base_p=Path(img_base_p + lang))
      )
      df = df[~df.image_ids.isna()]
      df["year"] = df["year"].astype(str).str.strip()
      df["answer_text"] = df["answer_text"].astype(str).str.strip()
      df["question_text"] = df["question_text"].astype(str).str.strip()
      ds = Dataset.from_pandas(df.reset_index(drop=True))
      # for javanese there are no background descs thus it is interpreted as dtype null. We need to change it to string
      features = ds.features.copy()
      features["background_description"] = Sequence(
          feature=Value(dtype="string", id=None), length=-1, id=None
      )
      ds = ds.cast(features)
  
      dsd[lang] = ds

      dsd.push_to_hub(
        "floschne/multimodal-m3exam", token=<OMITTED>
      )
Downloads last month
63

Paper for floschne/multimodal-m3exam