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