Git Product home page Git Product logo

qasc's Introduction

Question Answering via Sentence Composition (QASC)

QASC is a question-answering dataset with a focus on sentence composition. It consists of 9,980 8-way multiple-choice questions about grade school science (8,134 train, 926 dev, 920 test), and comes with a corpus of 17M sentences. This repository shows how to download the QASC dataset and corpus. Note that the test set does not have the answer key or fact annotations. To evaluate your model on the test set, please submit your predictions (limited to once/week to prevent over-fitting) to the QASC leaderboard in the CSV format described here. We also provide two sample baseline models that can be used to produce the predictions in this CSV format.

To cite this work, use:

 @inproceedings{Khot2019QASC,
   title={{QASC}: A Dataset for Question Answering via Sentence Composition},
   author={Tushar Khot and Peter Clark and Michal Guerquin and Peter Alexander Jansen and Ashish Sabharwal},
   booktitle={AAAI},
   year={2019},
  }

Table of Contents

Downloading Data

We release the data under CC BY license.

Dataset

Download and unzip the dataset into the data/QASC_Dataset folder:

mkdir -p data
wget http://data.allenai.org/downloads/qasc/qasc_dataset.tar.gz
tar xvfz qasc_dataset.tar.gz  -C data/
rm qasc_dataset.tar.gz

Corpus

Download and unzip the text corpus (17M sentences) into the data/QASC_Corpus folder:

mkdir -p data
wget http://data.allenai.org/downloads/qasc/qasc_corpus.tar.gz
tar xvfz qasc_corpus.tar.gz  -C data/
rm qasc_corpus.tar.gz

Models

Download and unzip the baseline models into the data/QASC_Models folder:

mkdir -p data
wget http://data.allenai.org/downloads/qasc/qasc_models.tar.gz
tar xvfz qasc_models.tar.gz  -C data/
rm qasc_models.tar.gz

Setting up the Environment

We currently use a fork of AllenNLP by Oyvind Tafjord to train and evaluate our models. To use this repository, setup a Python 3.6 environment in venv or conda (to ensure a clean setup) and install the requirements. For example, to setup using conda:

conda create -n qasc python=3.6
source activate qasc
pip install -r requirements.txt

We intend to release models and scripts that directly use AllenNLP/Transformers library by HuggingFace in the near future.

Evaluating Models

We release two sample models that predict answer choices based on (1) no knowledge and (2) single-step retrieval knowledge. Both models use BertMCQAModel that adds a linear layer on the output of the [CLS] token representation.

No Knowledge Baseline

This model can be run directly against the test set to produce predictions using AllenNLP's predict command:

python -m allennlp.run predict \
     --include-package qasc \
     --predictor multiple-choice-qa-json \
     --output-file data/nokb_predictions.jsonl \
     data/QASC_Models/bertlc_nokb/model.tar.gz  \
     data/QASC_Dataset/test.jsonl

To convert the predictions into the CSV format expected by the leaderboard, use jq, a command-line tool to parse JSON files:

jq -r "[.id,.answer]|@csv" data/nokb_predictions.jsonl > data/nokb_predictions.csv

Single Step Baseline

To run the single-step retrieval baseline, we provide the train, dev and test files with the retrieved context here. These JSONL files contain the retrieved context for each choice as a paragraph in the question.choices[].para field. The sentences are sorted in the reverse order of their retrieval scores before being concatenated to produce the paragraph. This ensures that the most relevant sentences are closer to the end and do not get removed when the context is truncated (from the front) to fit within 184 word-pieces.

To download the data:

wget http://data.allenai.org/downloads/qasc/qasc_dataset_1step.tar.gz
tar xvfz qasc_dataset_1step.tar.gz  -C data/
rm qasc_dataset_1step.tar.gz

To produce predictions:

python -m allennlp.run predict \
     --include-package qasc \
     --predictor multiple-choice-qa-json \
     --output-file data/1step_predictions.jsonl \
     data/QASC_Models/bertlc_1step/model.tar.gz  \
     data/QASC_Dataset_1Step/test.jsonl

jq -r "[.id,.answer]|@csv" data/1step_predictions.jsonl > data/1step_predictions.csv

qasc's People

Contributors

aimichal avatar tusharkhot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qasc's Issues

my allennlp-1.1.0 no module named allennlp.run

no module named allennlp.run
when excute:
python -m allennlp.run predict \

 --include-package qasc \
 --predictor multiple-choice-qa-json \
 --output-file data/1step_predictions.jsonl \
 data/QASC_Models/bertlc_1step/model.tar.gz  \
 data/QASC_Dataset_1Step/test.jsonl

Citation information

The only citation information appearing in your Github repository is inferred from the link to your paper in arXiv:

@article{allenai:qasc,
      author    = {Tushar Khot and Peter Clark and Michal Guerquin and Peter Jansen and Ashish Sabharwal},
      title     = {QASC: A Dataset for Question Answering via Sentence Composition},
      journal   = {arXiv:1910.11473v2},
      year      = {2020},
}

I just wanted to be sure that you do not prefer to use your reference to AAAI instead:

@article{Khot_Clark_Guerquin_Jansen_Sabharwal_2020,
  title = {QASC: A Dataset for Question Answering via Sentence Composition},
  volume = {34},
  url = {https://ojs.aaai.org/index.php/AAAI/article/view/6319},
  DOI = {10.1609/aaai.v34i05.6319},
  number = {05},
  journal = {Proceedings of the AAAI Conference on Artificial Intelligence},
  author = {Khot, Tushar and Clark, Peter and Guerquin, Michal and Jansen, Peter and Sabharwal, Ashish},
  year = {2020},
  month = {Apr.},
  pages = {8082-8090}
}

There's something wrong with the data set

"id": "3R2PKQ87NW7M2JUHD1FZY696IOVIM8" ,fact:“the seismometer will check for seismic activity”,
"id":"3AAJC4I4FGRIW1D6A8QTI9KFA8JZJ1",fact“:dehydration preserves foods by removing moisture”,they are not in corpus

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.