Datasets:
Commit ·
a35427c
verified ·
0
Parent(s):
Duplicate from derek-thomas/ScienceQA
Browse filesCo-authored-by: Derek Thomas <derek-thomas@users.noreply.huggingface.co>
Files changed (9)
- .gitattributesAdded+54
- .gitignoreAdded+4
- README.mdAdded+301
- data/test-00000-of-00001-f0e719df791966ff.parquetAdded+3
- data/train-00000-of-00001-1028f23e353fbe3e.parquetAdded+3
- data/validation-00000-of-00001-6c7328ff6c84284c.parquetAdded+3
- tutorial/ScienceQA.pyAdded+122
- tutorial/create_dataset.ipynbAdded
- tutorial/download.shAdded+36
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354*.7z filter=lfs diff=lfs merge=lfs -text*.arrow filter=lfs diff=lfs merge=lfs -text*.bin filter=lfs diff=lfs merge=lfs -text*.bz2 filter=lfs diff=lfs merge=lfs -text*.ckpt filter=lfs diff=lfs merge=lfs -text*.ftz filter=lfs diff=lfs merge=lfs -text*.gz filter=lfs diff=lfs merge=lfs -text*.h5 filter=lfs diff=lfs merge=lfs -text*.joblib filter=lfs diff=lfs merge=lfs -text*.lfs.* filter=lfs diff=lfs merge=lfs -text*.lz4 filter=lfs diff=lfs merge=lfs -text*.mlmodel filter=lfs diff=lfs merge=lfs -text*.model filter=lfs diff=lfs merge=lfs -text*.msgpack filter=lfs diff=lfs merge=lfs -text*.npy filter=lfs diff=lfs merge=lfs -text*.npz filter=lfs diff=lfs merge=lfs -text*.onnx filter=lfs diff=lfs merge=lfs -text*.ot filter=lfs diff=lfs merge=lfs -text*.parquet filter=lfs diff=lfs merge=lfs -text*.pb filter=lfs diff=lfs merge=lfs -text*.pickle filter=lfs diff=lfs merge=lfs -text*.pkl filter=lfs diff=lfs merge=lfs -text*.pt filter=lfs diff=lfs merge=lfs -text*.pth filter=lfs diff=lfs merge=lfs -text*.rar filter=lfs diff=lfs merge=lfs -text*.safetensors filter=lfs diff=lfs merge=lfs -textsaved_model/**/* filter=lfs diff=lfs merge=lfs -text*.tar.* filter=lfs diff=lfs merge=lfs -text*.tflite filter=lfs diff=lfs merge=lfs -text*.tgz filter=lfs diff=lfs merge=lfs -text*.wasm filter=lfs diff=lfs merge=lfs -text*.xz filter=lfs diff=lfs merge=lfs -text*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -text# Audio files - uncompressed*.pcm filter=lfs diff=lfs merge=lfs -text*.sam filter=lfs diff=lfs merge=lfs -text*.raw filter=lfs diff=lfs merge=lfs -text# Audio files - compressed*.aac filter=lfs diff=lfs merge=lfs -text*.flac filter=lfs diff=lfs merge=lfs -text*.mp3 filter=lfs diff=lfs merge=lfs -text*.ogg filter=lfs diff=lfs merge=lfs -text*.wav filter=lfs diff=lfs merge=lfs -text# Image files - uncompressed*.bmp filter=lfs diff=lfs merge=lfs -text*.gif filter=lfs diff=lfs merge=lfs -text*.png filter=lfs diff=lfs merge=lfs -text*.tiff filter=lfs diff=lfs merge=lfs -text# Image files - compressed*.jpg filter=lfs diff=lfs merge=lfs -text*.jpeg filter=lfs diff=lfs merge=lfs -text*.webp filter=lfs diff=lfs merge=lfs -text1234.ipynb_checkpoints.ideaimages/text/123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301---license: cc-by-sa-4.0annotations_creators:- expert-generated- foundlanguage:- enlanguage_creators:- expert-generated- foundmultilinguality:- monolingualpaperswithcode_id: scienceqapretty_name: ScienceQAsize_categories:- 10K<n<100Ksource_datasets:- originaltags:- multi-modal-qa- science- chemistry- biology- physics- earth-science- engineering- geography- history- world-history- civics- economics- global-studies- grammar- writing- vocabulary- natural-science- language-science- social-sciencetask_categories:- multiple-choice- question-answering- other- visual-question-answering- text-classificationtask_ids:- multiple-choice-qa- closed-domain-qa- open-domain-qa- visual-question-answering- multi-class-classificationdataset_info: features: - name: image dtype: image - name: question dtype: string - name: choices sequence: string - name: answer dtype: int8 - name: hint dtype: string - name: task dtype: string - name: grade dtype: string - name: subject dtype: string - name: topic dtype: string - name: category dtype: string - name: skill dtype: string - name: lecture dtype: string - name: solution dtype: string splits: - name: train num_bytes: 16416902 num_examples: 12726 - name: validation num_bytes: 5404896 num_examples: 4241 - name: test num_bytes: 5441676 num_examples: 4241 download_size: 0 dataset_size: 27263474---
# Dataset Card Creation Guide
## Table of Contents- [Dataset Card Creation Guide](#dataset-card-creation-guide) - [Table of Contents](#table-of-contents) - [Dataset Description](#dataset-description) - [Dataset Summary](#dataset-summary) - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards) - [Languages](#languages) - [Dataset Structure](#dataset-structure) - [Data Instances](#data-instances) - [Data Fields](#data-fields) - [Data Splits](#data-splits) - [Dataset Creation](#dataset-creation) - [Curation Rationale](#curation-rationale) - [Source Data](#source-data) - [Initial Data Collection and Normalization](#initial-data-collection-and-normalization) - [Who are the source language producers?](#who-are-the-source-language-producers) - [Annotations](#annotations) - [Annotation process](#annotation-process) - [Who are the annotators?](#who-are-the-annotators) - [Personal and Sensitive Information](#personal-and-sensitive-information) - [Considerations for Using the Data](#considerations-for-using-the-data) - [Social Impact of Dataset](#social-impact-of-dataset) - [Discussion of Biases](#discussion-of-biases) - [Other Known Limitations](#other-known-limitations) - [Additional Information](#additional-information) - [Dataset Curators](#dataset-curators) - [Licensing Information](#licensing-information) - [Citation Information](#citation-information) - [Contributions](#contributions)
## Dataset Description
- **Homepage:** [https://scienceqa.github.io/index.html#home](https://scienceqa.github.io/index.html#home)- **Repository:** [https://github.com/lupantech/ScienceQA](https://github.com/lupantech/ScienceQA)- **Paper:** [https://arxiv.org/abs/2209.09513](https://arxiv.org/abs/2209.09513)- **Leaderboard:** [https://paperswithcode.com/dataset/scienceqa](https://paperswithcode.com/dataset/scienceqa)- **Point of Contact:** [Pan Lu](https://lupantech.github.io/) or file an issue on [Github](https://github.com/lupantech/ScienceQA/issues)
### Dataset Summary
Learn to Explain: Multimodal Reasoning via Thought Chains for Science Question Answering
### Supported Tasks and Leaderboards
Multi-modal Multiple Choice
### Languages
English
## Dataset Structure
### Data Instances
Explore more samples [here](https://scienceqa.github.io/explore.html).
``` json{'image': Image, 'question': 'Which of these states is farthest north?', 'choices': ['West Virginia', 'Louisiana', 'Arizona', 'Oklahoma'], 'answer': 0, 'hint': '', 'task': 'closed choice', 'grade': 'grade2', 'subject': 'social science', 'topic': 'geography', 'category': 'Geography', 'skill': 'Read a map: cardinal directions', 'lecture': 'Maps have four cardinal directions, or main directions. Those directions are north, south, east, and west.\nA compass rose is a set of arrows that point to the cardinal directions. A compass rose usually shows only the first letter of each cardinal direction.\nThe north arrow points to the North Pole. On most maps, north is at the top of the map.', 'solution': 'To find the answer, look at the compass rose. Look at which way the north arrow is pointing. West Virginia is farthest north.'}```
Some records might be missing any or all of image, lecture, solution.
### Data Fields
- `image` : Contextual image- `question` : Prompt relating to the `lecture`- `choices` : Multiple choice answer with 1 correct to the `question`- `answer` : Index of choices corresponding to the correct answer- `hint` : Hint to help answer the `question`- `task` : Task description- `grade` : Grade level from K-12- `subject` : High level - `topic` : natural-sciences, social-science, or language-science- `category` : A subcategory of `topic`- `skill` : A description of the task required- `lecture` : A relevant lecture that a `question` is generated from- `solution` : Instructions on how to solve the `question`
Note that the descriptions can be initialized with the **Show Markdown Data Fields** output of the [Datasets Tagging app](https://huggingface.co/spaces/huggingface/datasets-tagging), you will then only need to refine the generated descriptions.
### Data Splits- name: train - num_bytes: 16416902 - num_examples: 12726- name: validation - num_bytes: 5404896 - num_examples: 4241- name: test - num_bytes: 5441676 - num_examples: 4241
## Dataset Creation
### Curation Rationale
When answering a question, humans utilize the information available across different modalities to synthesize a consistent and complete chain of thought (CoT). This process is normally a black box in the case of deep learning models like large-scale language models. Recently, science question benchmarks have been used to diagnose the multi-hop reasoning ability and interpretability of an AI system. However, existing datasets fail to provide annotations for the answers, or are restricted to the textual-only modality, small scales, and limited domain diversity. To this end, we present Science Question Answering (ScienceQA).
### Source Data
ScienceQA is collected from elementary and high school science curricula.
#### Initial Data Collection and Normalization
See Below
#### Who are the source language producers?
See Below
### Annotations
Questions in the ScienceQA dataset are sourced from open resources managed by IXL Learning,an online learning platform curated by experts in the field of K-12 education. The dataset includesproblems that align with California Common Core Content Standards. To construct ScienceQA, wedownloaded the original science problems and then extracted individual components (e.g. questions,hints, images, options, answers, lectures, and solutions) from them based on heuristic rules.We manually removed invalid questions, such as questions that have only one choice, questions thatcontain faulty data, and questions that are duplicated, to comply with fair use and transformativeuse of the law. If there were multiple correct answers that applied, we kept only one correct answer.Also, we shuffled the answer options of each question to ensure the choices do not follow anyspecific pattern. To make the dataset easy to use, we then used semi-automated scripts to reformatthe lectures and solutions. Therefore, special structures in the texts, such as tables and lists, areeasily distinguishable from simple text passages. Similar to ImageNet, ReClor, and PMR datasets,ScienceQA is available for non-commercial research purposes only and the copyright belongs tothe original authors. To ensure data quality, we developed a data exploration tool to review examplesin the collected dataset, and incorrect annotations were further manually revised by experts. The toolcan be accessed at https://scienceqa.github.io/explore.html.
#### Annotation process
See above
#### Who are the annotators?
See above
### Personal and Sensitive Information
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
## Considerations for Using the Data
### Social Impact of Dataset
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
### Discussion of Biases
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
### Other Known Limitations
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
## Additional Information
### Dataset Curators
- Pan Lu1,3- Swaroop Mishra2,3- Tony Xia1- Liang Qiu1- Kai-Wei Chang1- Song-Chun Zhu1- Oyvind Tafjord3- Peter Clark3- Ashwin Kalyan3 From: 1. University of California, Los Angeles 2. Arizona State University 3. Allen Institute for AI
### Licensing Information
[Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)](https://creativecommons.org/licenses/by-nc-sa/4.0/)
### Citation Information
Provide the [BibTex](http://www.bibtex.org/)-formatted reference for the dataset. For example:```@inproceedings{lu2022learn, title={Learn to Explain: Multimodal Reasoning via Thought Chains for Science Question Answering}, author={Lu, Pan and Mishra, Swaroop and Xia, Tony and Qiu, Liang and Chang, Kai-Wei and Zhu, Song-Chun and Tafjord, Oyvind and Clark, Peter and Ashwin Kalyan}, booktitle={The 36th Conference on Neural Information Processing Systems (NeurIPS)}, year={2022}}```### Contributions
Thanks to [Derek Thomas](https://huggingface.co/derek-thomas) [@datavistics](https://github.com/datavistics) for adding this dataset.123version https://git-lfs.github.com/spec/v1oid sha256:235e92d1f30155266df76bc9f28fc6e4fcb6bec2c6a8c7d67f9086ea6b392a84size 122386007123version https://git-lfs.github.com/spec/v1oid sha256:62c90a28e3fb1bc0ad7bbcab1ac62b483ae6758291a655944d8f494bf6445745size 377460993123version https://git-lfs.github.com/spec/v1oid sha256:e66b5215ce71e748ade4ee629bc14fbf86762071d355a4fcd831581cc04d72d8size 126235086123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122import jsonfrom pathlib import Path
import datasets
_DESCRIPTION = """Science Question Answering (ScienceQA), a new benchmark that consists of 21,208 multimodal multiple choice questions with a diverse set of science topics and annotations of their answers with corresponding lectures and explanations. The lecture and explanation provide general external knowledge and specific reasons,respectively, for arriving at the correct answer."""
# Lets use the project page instead of the github repo_HOMEPAGE = "https://scienceqa.github.io"
_CITATION = """\@inproceedings{lu2022learn, title={Learn to Explain: Multimodal Reasoning via Thought Chains for Science Question Answering}, author={Lu, Pan and Mishra, Swaroop and Xia, Tony and Qiu, Liang and Chang, Kai-Wei and Zhu, Song-Chun and Tafjord, Oyvind and Clark, Peter and Ashwin Kalyan}, booktitle={The 36th Conference on Neural Information Processing Systems (NeurIPS)}, year={2022}}"""
_LICENSE = "Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)"
class ScienceQA(datasets.GeneratorBasedBuilder): """Science Question Answering (ScienceQA), a new benchmark that consists of 21,208 multimodalmultiple choice questions with a diverse set of science topics and annotations of their answerswith corresponding lectures and explanations.The lecture and explanation provide general external knowledge and specific reasons,respectively, for arriving at the correct answer."""
VERSION = datasets.Version("1.0.0")
def _info(self): return datasets.DatasetInfo( description=_DESCRIPTION, features=datasets.Features( { "image": datasets.Image(), "question": datasets.Value("string"), "choices": datasets.features.Sequence(datasets.Value("string")), "answer": datasets.Value("int8"), "hint": datasets.Value("string"), "task": datasets.Value("string"), "grade": datasets.Value("string"), "subject": datasets.Value("string"), "topic": datasets.Value("string"), "category": datasets.Value("string"), "skill": datasets.Value("string"), "lecture": datasets.Value("string"), "solution": datasets.Value("string") } ), homepage=_HOMEPAGE, citation=_CITATION, license=_LICENSE, )
def _split_generators(self, dl_manager): text_path = Path.cwd() / 'text' / 'problems.json' image_dir = Path.cwd() / 'images' return [ datasets.SplitGenerator( name=datasets.Split.TRAIN, # These kwargs will be passed to _generate_examples gen_kwargs={ "text_path": text_path, "image_dir": image_dir, "split": "train", }, ), datasets.SplitGenerator( name=datasets.Split.VALIDATION, # These kwargs will be passed to _generate_examples gen_kwargs={ "text_path": text_path, "image_dir": image_dir, "split": "val", }, ), datasets.SplitGenerator( name=datasets.Split.TEST, # These kwargs will be passed to _generate_examples gen_kwargs={ "text_path": text_path, "image_dir": image_dir, "split": "test" }, ), ]
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators` def _generate_examples(self, text_path, image_dir, split): with open(text_path, encoding="utf-8") as f: # Load all the text. Note that if this was HUGE, we would need to find a better way to load the json data = json.load(f) ignore_keys = ['image', 'split']
# Get image_id from its annoying location for image_id, row in data.items(): # Only look for the rows in our split if row['split'] == split:
# Note, not all rows have images. # Get all the image data we need if row['image']: image_path = image_dir / split / image_id / 'image.png' image_bytes = image_path.read_bytes() image_dict = {'path': str(image_path), 'bytes': image_bytes} else: image_dict = None
# Keep only the keys we need relevant_row = {k: v for k, v in row.items() if k not in ignore_keys}
return_dict = { 'image': image_dict, **relevant_row } yield image_id, return_dict123456789101112131415161718192021222324252627282930313233343536#!/bin/bash# Modified from the original here: https://github.com/lupantech/ScienceQA/blob/main/tools/download.sh
cd images
if [ -d "train" ];then echo "Already downloaded train"else ls -alF wget https://scienceqa.s3.us-west-1.amazonaws.com/images/train.zip unzip -q train.zip rm train.zipfi
if [ -d "val" ];then echo "Already downloaded val"else ls -alF wget https://scienceqa.s3.us-west-1.amazonaws.com/images/val.zip unzip -q val.zip rm val.zipfi
if [ -d "test" ];then echo "Already downloaded test"else ls -alF wget https://scienceqa.s3.us-west-1.amazonaws.com/images/test.zip unzip -q test.zip rm test.zipfi
echo "Completed downloads!".gitattributesAdded+54
.gitignoreAdded+4
README.mdAdded+301
data/test-00000-of-00001-f0e719df791966ff.parquetAdded+3
data/train-00000-of-00001-1028f23e353fbe3e.parquetAdded+3
data/validation-00000-of-00001-6c7328ff6c84284c.parquetAdded+3
tutorial/ScienceQA.pyAdded+122
tutorial/create_dataset.ipynbAdded
tutorial/download.shAdded+36