Giter Site home page Giter Site logo

cnn-qa's Introduction

CNN-QA: CNN for Multiple Choice Question Answering

This repository contains code for the paper:

  • CNN for Text-Based Multiple Choice Question Answering. Akshay Chaturvedi, Onkar Pandit and Utpal Garain. ACL 2018

Dependencies

  1. Keras v2.0.8 with Theano (v 0.9.0) backend
  2. PyLucene 6.5.0 http://lucene.apache.org/pylucene/
  3. Pickle, NLTK, numpy, json, gensim

Pylucene is needed for query expansion based paragraph selection.

Before training

TQA dataset can be downloaded from http://data.allenai.org/tqa/. SciQ dataset can be downloaded from http://data.allenai.org/sciq/. Once downloaded, extract the folders in the data subdirectory of TQA and SciQ.

Word Vectors can be downloaded from https://drive.google.com/file/d/0B7XkCwpI5KDYNlNUTTlSS21pQmM/edit. Place the tgz file in word2vec folder.

Training

Run the file tqa_system.py, sciq_system.py to start training.

Evaluation

For TQA dataset, once the model is trained, modify tqa_system.py depending on which split you want to evaluate and then run result.py. First evaluate the trained model on train set using different thresholds. Once the threshold is fixed, evaluate the model on other splits.

For SciQ dataset, the model can be evaluated by simply modifying and running sciq_system.py since the dataset has no forbidden questions.

cnn-qa's People

Contributors

akshay107 avatar

Stargazers

 avatar  avatar  avatar Patrick avatar Fariz Ikhwantri avatar sumyyyyy avatar  avatar Manimaran avatar Deya Chatterjee avatar Daniel Duckworth avatar YingjieGu avatar Xiaoye Qu avatar kandorm avatar su avatar Shubham Pachori avatar VHT avatar 周炀 avatar Simon Šuster avatar  avatar

Watchers

James Cloos avatar  avatar

cnn-qa's Issues

TypeError: unsupported operand type(s) for *: 'NoneType' and 'int'

I am using following versions
Name: Theano
Version: 0.9

Name: gensim
Version: 2.3.0

Name: Keras
Version: 2.0.0

stack trace:
using Theano backend.
Traceback (most recent call last):
File "tqa_system.py", line 62, in
tqa_sys.train_ndq_model()
File "tqa_system.py", line 38, in train_ndq_model
train_model = model.get_cnn_model2()
File "/Users/muhammadzohaib/development/CNN-QA/TQA/code/model.py", line 152, in get_cnn_model2
q_rep = tile_q(q_exp)
File "/Users/muhammadzohaib/Library/Python/2.7/lib/python/site-packages/keras/engine/topology.py", line 545, in call
output = self.call(inputs, **kwargs)
File "/Users/muhammadzohaib/Library/Python/2.7/lib/python/site-packages/keras/layers/core.py", line 659, in call
return self.function(inputs, **arguments)
File "/Users/muhammadzohaib/development/CNN-QA/TQA/code/model.py", line 140, in
tile_q = Lambda(lambda xin: K.tile(xin,(1,self.max_opt_count,1,1)),output_shape=(self.max_opt_count,self.max_q_length,self.word_vec_size))
File "/Users/muhammadzohaib/Library/Python/2.7/lib/python/site-packages/keras/backend/theano_backend.py", line 831, in tile
y._keras_shape = tuple(xshape * n)
TypeError: unsupported operand type(s) for *: 'NoneType' and 'int'

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.