File size: 2,427 Bytes
81dbf3e 473bcaa 9405632 81dbf3e d29dd42 81dbf3e ac1f94b 81dbf3e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
---
license: apache-2.0
---
# Model description
This is an [mt5-base](https://huggingface.co/google/mt5-base) model, finetuned to generate questions using [TyDi QA](https://huggingface.co/datasets/tydiqa) dataset. It was trained to take the context and answer as input to generate questions.
# Overview
*Language model*: mT5-base \
*Language*: Arabic, Bengali, English, Finnish, Indonesian, Korean, Russian, Swahili, Telugu \
*Task*: Question Generation \
*Data*: TyDi QA
# Intented use and limitations
One can use this model to generate questions. Biases associated with pre-training of mT5 and TyDiQA dataset may be present.
## Usage
One can use this model directly in the [PrimeQA](https://github.com/primeqa/primeqa) framework as in this example [notebook](https://github.com/primeqa/primeqa/blob/main/notebooks/qg/tableqg_inference.ipynb).
Or
```python
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("PrimeQA/mt5-base-tydi-question-generator")
model = AutoModelForSeq2SeqLM.from_pretrained("PrimeQA/mt5-base-tydi-question-generator")
def get_question(answer, context, max_length=64):
input_text = answer +" <<sep>> " + context
features = tokenizer([input_text], return_tensors='pt')
output = model.generate(input_ids=features['input_ids'],
attention_mask=features['attention_mask'],
max_length=max_length)
return tokenizer.decode(output[0])
context = "শচীন টেন্ডুলকারকে ক্রিকেট ইতিহাসের অন্যতম সেরা ব্যাটসম্যান হিসেবে গণ্য করা হয়।"
answer = "শচীন টেন্ডুলকার"
get_question(answer, context)
# output: ক্রিকেট ইতিহাসের অন্যতম সেরা ব্যাটসম্যান কে?
```
## Citation
```bibtex
@inproceedings{xue2021mt5,
title={mT5: A Massively Multilingual Pre-trained Text-to-Text Transformer},
author={Xue, Linting and Constant, Noah and Roberts, Adam and
Kale, Mihir and Al-Rfou, Rami and Siddhant, Aditya and
Barua, Aditya and Raffel, Colin},
booktitle={Proceedings of the 2021 Conference of the North American
Chapter of the Association for Computational Linguistics:
Human Language Technologies},
pages={483--498},
year={2021}
}
```
|