Generating actual answers from QA models
Hi everybody,I’m planning or training a BARTQA model, but before training I would like to test how to actually generate an answer at inference time. I’ve looked through the documentation, but I couldn’t find an obvious answer. Can I do it using the BARTForQuestionAnswering model or do I have to use the BARTForConditionalGeneration model that has the generate() method?Thank you very much for any help!Antonio
2021-10-25T12:55:36Z
Hi,Solving question-answering using Transformers is usually done in one of 2 ways:eitherextractive, where the model predictsstart_scoresandend_scores. In other words, the model predicts which token it believes is at the start of the answer, and which token is at the end of the answer. This was introduced in the originalBERT paper.eithergenerative, where the model simply generates the correct answer. This was introduced in theT5 paper, where they treated every NLP problem as a generative task.As BART is a seq2seq (encoder-decoder) model similar to T5, it makes sense to useBartForConditionalGeneration. You can indeed use the.generate()method at inference time to let it generate a predicted answer. However,BartForQuestionAnsweringis also available in the library, meaning you can also use BART to do BERT-like extractive question answering.If you ask me, option 2 is much simpler, and more “human-like”.
2021-10-26T08:08:12Z
Isn’t BARTForConditionalGeneration trained for summarization, though? I’m going to finetune it but idk how much the model’s behaviour will change.Thank you very much for your anwser!