bert icon indicating copy to clipboard operation
bert copied to clipboard

Simplifying BERT for Q&A - One paragraph and Query

Open Shivanandroy opened this issue 8 years ago • 5 comments

Let's suppose - P = Single paragraph (text | string) Q = Single Query M = Trained Tensorflow Model (.ckpt)

I'm looking for a simplified piece of code which takes above 3 files as inputs and outputs an answer for my query Q.

Shivanandroy avatar Nov 21 '18 17:11 Shivanandroy

You can look at the implementation in run_squad.py (or others repos like https://github.com/huggingface/pytorch-pretrained-BERT : BertForQuestionAnswering).

artemisart avatar Nov 22 '18 13:11 artemisart

Yes, artemisart is correct, you'll have to modify run_squad.py to do what you need. We haven't released pre-trained SQuAD models since SQuAD is mostly useful as an academic dataset rather than as a general-purpose QA system.

jacobdevlin-google avatar Nov 23 '18 22:11 jacobdevlin-google

@artemisart I just want something like the opener above. Given the query and corresponding answers I want to train just with those both sets an association between Q and A without given a span. I thought first the opener actually wanted the same.

datistiquo avatar Feb 22 '19 10:02 datistiquo

@datistiquo You should tell BERT where he should find that answer. Let's use an example:

Q: where can we find a lot of sand? Text: There is a lot of sand on the beach. A lot of people go to the beach.

If you "tell" Google BERT that the first reference of "the beach" is the answer, then it is better able to pick the right answer for the good reason. This would be ideal.

If your answer is in your text multiple times and you are not willing/able to select the right one for the entire training set, you could say that both options are 50% (or 1/n) likely. Then your training data is less good, but it might actually still be enough to get a decent performing QA system.

HarmC avatar Aug 28 '19 12:08 HarmC

Let's suppose - P = Single paragraph (text | string) Q = Single Query M = Trained Tensorflow Model (.ckpt)

I'm looking for a simplified piece of code which takes above 3 files as inputs and outputs an answer for my query Q.

Hi, I'm in the same situation. Something simple. but after a week or so reading about anything BERT related I got to this. https://github.com/cdqa-suite/cdQA See if it fits your need.. sure it fits mine. Cheers

vinnytwice avatar Oct 10 '19 19:10 vinnytwice