Git Product home page Git Product logo

openqa's Introduction

Open-QA

The source codes for paper "Denoising Distantly Supervised Open-Domain Question Answering", which is modified based on the code of paper " Reading Wikipedia to Answer Open-Domain Questions."

Requirements

pytorch 0.3.0 numpy scikit-learn termcolor regex tqdm prettytable scipy nltk pexpect 4.2.1

Evaluation Results

Dataset Quasar-T SearchQA TrivialQA SQuAD
Models EM F1 EM F1 EM F1 EM F1
GA (Dhingra et al., 2017) 26.4 26.4 - - - -
BiDAF (Seo et al., 2017) 25.9 28.5 28.6 34.6 - - - -
AQA (Buck et al., 2017) - - 40.5 47.4 - - - -
R^3 (Wang et al., 2018a) 35.3 41.7 49 55.3 47.3 53.7 29.1 37.5
Our Model 42.2 49.3 58.8 64.5 48.7 56.3 28.7 36.6

Data

We provide Quasar-T, SearchQA and TrivialQA dataset we used for the task in data/ directory. We preprocess the original data to make it satisfy the input format of our codes, and can be download at here.

To run our code, the dataset should be put in the folder data/ using the following format:

datasets/

  • train.txt, dev.txt, test.txt: format for each line: {"question": quetion, "answers":[answer1, answer2, ...]}.

  • train.json, dev.json, test.json: format [{"question": question, "document":document1},{"question": question, "document":document2}, ...].

embeddings/

  • glove.840B.300d.txt: word vectors obtained from here.

corenlp/

  • all jar files from Stanford Corenlp.

Codes

The source codes of our models are put in the folders src/.

Train and Test

For training and test, you need to:

  1. Pre-train the paragraph reader: python main.py --batch-size 256 --model-name quasart_reader --num-epochs 10 --dataset quasart --mode reader

  2. Pre-train the paragraph selector: python main.py --batch-size 64 --model-name quasart_selector --num-epochs 10 --dataset quasart --mode selector --pretrained models/quasart_reader.mdl

  3. Train the whole model: python main.py --batch-size 32 --model-name quasart_all --num-epochs 10 --dataset quasart --mode all --pretrained models/quasart_selector.mdl

Cite

If you use the code, please cite the following paper:

  1. Yankai Lin, Haozhe Ji, Zhiyuan Liu, and Maosong Sun. 2018. Denoising Distantly Supervised Open-Domain Question Answering. In Proceedings of ACL. pages 1736--1745. [pdf]

Reference

  1. Bhuwan Dhingra, Hanxiao Liu, Zhilin Yang, William Cohen, and Ruslan Salakhutdinov. 2017. Gated-attention readers for text comprehension. In Proceedings of ACL. pages 1832--1846.

  2. Minjoon Seo, Aniruddha Kembhavi, Ali Farhadi, and Hannaneh Hajishirzi. 2017. Bidirectional attention flow for machine comprehension. In Proceedings of ICLR.

  3. Christian Buck, Jannis Bulian, Massimiliano Ciaramita, Andrea Gesmundo, Neil Houlsby, Wojciech Gajewski, and Wei Wang. 2017. Ask the right questions: Active question reformulation with reinforcement learning. arXiv preprint arXiv:1705.07830.

  4. Shuohang Wang, Mo Yu, Xiaoxiao Guo, Zhiguo Wang,Tim Klinger, Wei Zhang, Shiyu Chang, Gerald Tesauro, Bowen Zhou, and Jing Jiang. 2018. R3: Reinforced ranker-reader for open-domain question answering. In Proceedings of AAAI. pages 5981--5988.

openqa's People

Contributors

mrlyk423 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openqa's Issues

Results on Open SQuAD

Hi!

Thanks for nice work and publishing source code.
Can you, please, report results on Open-SQuAD as well?
You mentioned on ACL 18 that you have evaluated your model on this dataset.

Thanks!

A interactive demo ?

Hi !

Nice project, very interresting.
Do you have an interactive mode ?
Like DrQA and its pre-trained model.

Otherwise, after training the model, how can I use this algorithm ?

Thanks a lot

IndexError: too many indices for array & out of range

When I run python main --batch-size 256 --model-name quasart_reader --num-epochs 10 --dataset quasart --mode reader, I got:

08/20/2018 01:34:57 PM: [ 16 ]
08/20/2018 01:34:57 PM: [ 16 ]
08/20/2018 01:34:57 PM: [ 16 ]
08/20/2018 01:34:57 PM: [ [(1, 1), (9, 9)] ]
Traceback (most recent call last):
File "\src\reader\model.py", line 253, in update
if (tmp1.data.cpu().numpy()[0]<(score_s[i][target_s[i][j][0]]*score_e[i][target_s[i][j][1]]).data.cpu().numpy()[0]):
IndexError: too many indices for array

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "main.py", line 820, in
main(args)
File "main.py", line 744, in main
pretrain_reader(args, train_loader_with_doc, model, stats, train_exs_with_doc, train_docs)
File "main.py", line 376, in pretrain_reader
train_loss.update(*model.update(ex_with_doc[idx_doc], l_list, r_list, HasAnswer_list[idx_doc]))
File "\src\reader\model.py", line 264, in update
logger.info(target_e[i])
IndexError: list index out of range

代码中的一些小问题

首先,非常感谢您的这个工作,让我这个QA爱好者有一个向您学习的机会,看到您昨天还修改了代码,十分感谢。
但是我在运行您的开源代码时,还是遇到了以下一些小问题,还烦请指正:

· 在main.py的762行regex.split()是否应改成re.split()
· 在main.py的659行的两个参数train_exs和dev_exs是否应改为train_exs_with_doc以及dev_exs_with_doc
· src/init.py里还是import了pipelines,虽然已经删除了
· 在reader/model.py中的571行,调用了pipelines的PROCESS_CANDS,这里该如何处理

再次感谢!

Question about triviaQA testing

Hey, thanks for the work and open-sourcing.

Just have a possibly silly question which I hope you can help me with.

How do I evaluate on TriviaQA unfiltered setting on the codalab leaderboard?

Do I just make a json file with question id ({'tc_7:ans'})?

Thanks!

程序运行出错

image

你好,我在配置好环境后,按照README上面的步骤运行程序,出现这个错误,请问如何解决呢?

Timeout issue

After doing all the setup, While running with the command given in the readme I am getting this issue.

Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/pexpect/expect.py", line 99, in expect_loop
incoming = spawn.read_nonblocking(spawn.maxread, timeout)
File "/usr/local/lib/python3.6/dist-packages/pexpect/pty_spawn.py", line 462, in read_nonblocking
raise TIMEOUT('Timeout exceeded.')
pexpect.exceptions.TIMEOUT: Timeout exceeded.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "main.py", line 816, in
main(args)
File "main.py", line 611, in main
PROCESS_TOK = tok_class(**tok_opts)
File "/OpenQA/src/tokenizers/corenlp_tokenizer.py", line 33, in init
self._launch()
File "/OpenQA/src/tokenizers/corenlp_tokenizer.py", line 61, in _launch
self.corenlp.expect_exact('NLP>', searchwindowsize=100)
File "/usr/local/lib/python3.6/dist-packages/pexpect/spawnbase.py", line 390, in expect_exact
return exp.expect_loop(timeout)
File "/usr/local/lib/python3.6/dist-packages/pexpect/expect.py", line 107, in expect_loop
return self.timeout(e)
File "/usr/local/lib/python3.6/dist-packages/pexpect/expect.py", line 70, in timeout
raise TIMEOUT(msg)
pexpect.exceptions.TIMEOUT: Timeout exceeded.
<pexpect.pty_spawn.spawn object at 0x7fc2939ace10>
command: /bin/bash
args: ['/bin/bash']
buffer (last 100 chars): b'0:/OpenQA# bash: java: command not found\r\n\x1b]0;root@392696d4bc50: /OpenQA\x07root@392696d4bc50:/OpenQA# '
before (last 100 chars): b'0:/OpenQA# bash: java: command not found\r\n\x1b]0;root@392696d4bc50: /OpenQA\x07root@392696d4bc50:/OpenQA# '
after: <class 'pexpect.exceptions.TIMEOUT'>
match: None
match_index: None
exitstatus: None
flag_eof: False
pid: 533
child_fd: 7
closed: False
timeout: 60
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 100000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_string:
0: "b'NLP>'"

How to test the trained paragraph selector model?

Hi,Thanks for your work! I have trained a paragraph reader and paragraph selector model. Now I want to test my data with this model and select the paragraphs related to the question. How should I test?

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.