Downloads · 30 days
35
1% of all-time downloads
kleinay/qanom-seq2seq-model-baseline
qanom-seq2seq-model-baseline is a machine learning model from kleinay. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers.
This is a t5-small pretrained model, fine-tuned on the task of generating QANom QAs.
Downloads · 30 days
35
1% of all-time downloads
All-time downloads
3K
Public
Repo size
484 MB
Likes
0
Public
Click a slice to open those files.
.bin242 MB · 99%
From the Hugging Face model README
This is a t5-small pretrained model, fine-tuned on the task of generating QANom QAs.
"QANom" stands for "QASRL for Nominalizations", which is an adaptation of QASRL (Question-Answer driven Semantic Role Labeling) for the nominal predicates domain. See the QANom paper for details about the task. The QANom Dataset official site is a Google drive, but we also wrapped it into a Huggingface Dataset, which is easier to plug-and-play with (check out our HF profile for other related datasets, such as QASRL, QAMR, QADiscourse, and QA-Align).
Visit our demo for interactively exploring our model!
The model and tokenizer can be downloaded as simply as running:
import transformers
model = transformers.AutoModelForSeq2SeqLM.from_pretrained("kleinay/qanom-seq2seq-model-baseline")
tokenizer = transformers.AutoTokenizer.from_pretrained("kleinay/qanom-seq2seq-model-baseline")
However, the model fine-tuning procedure involves input preprocessing (marking the predicate in the sentence, T5's "task prefix", incorporating the predicate type and/or the verbal for of the nominalization) and output postprocessing (parsing the sequence into a list of QASRL-formatted QAs).
In order to use the model for QANom parsing easily, we suggest downloading the pipeline.py file from this repository, and then use the QASRL_Pipeline class:
from pipeline import QASRL_Pipeline
pipe = QASRL_Pipeline("kleinay/qanom-seq2seq-model-baseline")
pipe("The student was interested in Luke 's <predicate> research about see animals .", verb_form="research", predicate_type="nominal")
Which will output:
[{'generated_text': 'who _ _ researched something _ _ ?<extra_id_7> Luke',
'QAs': [{'question': 'who researched something ?', 'answers': ['Luke']}]}]
You can learn more about using transformers.pipelines in the official docs.
Notice that you need to specify which word in the sentence is the predicate, about which the question will interrogate. By default, you should precede the predicate with the <predicate> symbol, but you can also specify your own predicate marker:
pipe("The student was interested in Luke 's <PRED> research about see animals .", verb_form="research", predicate_type="nominal", predicate_marker="<PRED>")
In addition, you can specify additional kwargs for controling the model's decoding algorithm:
pipe("The student was interested in Luke 's <predicate> research about see animals .", verb_form="research", predicate_type="nominal", num_beams=3)