๐ MixQG (3b-sized model)
MixQG is a novel question generation model pre - trained on a set of QA datasets with diverse answer types. It was presented in the paper MixQG: Neural Question Generation with Mixed Answer Types, and the corresponding code is available in this repository.
๐ Quick Start
โจ Features
MixQG is pre - trained on a collection of QA datasets with mixed answer types, enabling it to generate diverse questions.
๐ฆ Installation
The installation is mainly about setting up the necessary Python libraries. You can install the transformers
library via pip install transformers
to use the model.
๐ป Usage Examples
Basic Usage
Using Huggingface pipeline abstraction:
from transformers import pipeline
nlp = pipeline("text2text-generation", model='Salesforce/mixqg-3b', tokenizer='Salesforce/mixqg-3b')
CONTEXT = "In the late 17th century, Robert Boyle proved that air is necessary for combustion."
ANSWER = "Robert Boyle"
def format_inputs(context: str, answer: str):
return f"{answer} \\n {context}"
text = format_inputs(CONTEXT, ANSWER)
nlp(text)
Advanced Usage
Using the pre - trained model directly:
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained('Salesforce/mixqg-3b')
model = AutoModelForSeq2SeqLM.from_pretrained('Salesforce/mixqg-3b')
CONTEXT = "In the late 17th century, Robert Boyle proved that air is necessary for combustion."
ANSWER = "Robert Boyle"
def format_inputs(context: str, answer: str):
return f"{answer} \\n {context}"
text = format_inputs(CONTEXT, ANSWER)
input_ids = tokenizer(text, return_tensors="pt").input_ids
generated_ids = model.generate(input_ids, max_length=32, num_beams=4)
output = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)
print(output)
๐ Documentation
Citation
@misc{murakhovska2021mixqg,
title={MixQG: Neural Question Generation with Mixed Answer Types},
author={Lidiya Murakhovs'ka and Chien-Sheng Wu and Tong Niu and Wenhao Liu and Caiming Xiong},
year={2021},
eprint={2110.08175},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
๐ง Technical Details
MixQG is a question generation model pre - trained on QA datasets with mixed answer types. It leverages the power of neural networks to generate relevant questions based on given context and answers.
๐ License
The README does not provide specific license information.
โ ๏ธ Important Note
This release is for research purposes only in support of an academic paper. Our models, datasets, and code are not specifically designed or evaluated for all downstream purposes.
๐ก Usage Tip
We strongly recommend users evaluate and address potential concerns related to accuracy, safety, and fairness before deploying this model. Consider the common limitations of AI, comply with applicable laws, and leverage best practices when selecting use cases, particularly for high - risk scenarios where errors or misuse could significantly impact peopleโs lives, rights, or safety. For further guidance on use cases, refer to our AUP and AI AUP.