allenai / allennlp

An open-source NLP research library, built on PyTorch.
http://www.allennlp.org
Apache License 2.0
11.76k stars 2.25k forks source link

Asking about configuring BiDAF model #2565

Closed CuriousKomodo closed 5 years ago

CuriousKomodo commented 5 years ago

System (please complete the following information):

Question

Hi, I am a newbie to Python and NLP.

I'm working on a question answering task on Squad 2.0 using the BiDAF model from allennlp and I would like to add Elmo embedding. I have installed allennlp in my python 3.6 environment. According to the tutorial, I need to modify the configuration file for that model. But I could not locate the folder called 'training_config' in my allennlp package path. In that case, how do I configure the model?

After I have configured the BiDAF model, how do I then train the BiDAF + Elmo model?

Best wishes, Kefei

matt-gardner commented 5 years ago

You can find a BiDAF training configuration here, and a BiDAF+ELMo training configuration here. You then train it with a command like is found here in the "Training" box under "Machine Comprehension".

CuriousKomodo commented 5 years ago

@matt-gardner

Hi Matt, thank you for your fast reply. I see now by running a single line, for example, 'allennlp train training_config/bidaf.jsonnet -s ', I train the BiDAF model using Squad 1.1.

How do I configure this so the model is trained on Squad 2.0 (since I cannot find the 'train_config' folder in my allennlp package)? And as there are artificial answers and impossible questions, will i have to modify some parts of the model too?

Best wishes, Kefei

matt-gardner commented 5 years ago

Oh, sorry I missed that in your original question. None of us have worked on SQuAD 2.0. The model will certainly have to change in order to account for the unanswerable questions (and the dataset reader will likely also need at least a little modification). If you're going to do this, I'd probably recommend starting with QANet instead of BiDAF, as it's a better model (or you could use a BERT-related one, from the hugging face repository). If you do get something running in allennlp on SQuAD 2.0, we'd love to hear about it and have you consider contributing it back!

CuriousKomodo commented 5 years ago

@matt-gardner My project is to compare the performance of a BERT-related model with Elmo + BiDAF on SQuAD, and I will definitely check out the hugging face repository. :)

It is just a little bit confusing that BiDAF + Elmo model by AllenNLP is on the SQuAD2.0 leaderboard, as you can see in this link: https://rajpurkar.github.io/SQuAD-explorer If you could let me know what is happening there...

I have not figured out how to adapt a BiDAF model for SQuAD 2.0. But if this succeeds, it would be a privilege to contribute back to AllenNLP's work.

Best wishes, Kefei

matt-gardner commented 5 years ago

That adaptation was done by other folks. If anyone seeing this thread knows where the code and model are that produced that result, I'd love to see it, but I don't know anything about it.

matt-gardner commented 5 years ago

@my89, you have any idea here? You ran on SQuAD 2.0, didn't you?

CuriousKomodo commented 5 years ago

@matt-gardner I have decided to just use the squad1.1 dataset for now. Thank you Matt for you help!