File size: 2,235 Bytes
2c864dc
 
 
6d03bb5
2c864dc
 
 
 
 
5157a6f
8745c1c
c50aeb7
cfe6fd1
c50aeb7
 
8a95f0f
c50aeb7
cfe6fd1
c50aeb7
cfe6fd1
 
 
8745c1c
c50aeb7
 
 
 
1108857
 
c50aeb7
1108857
 
84d08a3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8745c1c
1108857
 
 
 
 
 
 
 
 
 
 
 
 
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
57
58
59
60
61
---
language: id
datasets:
- SQuADv2.0
tags: 
- question-generation
- multitask-model
- idt5
widget:
- text: "generate question: <hl> Dua orang <hl> pengembara berjalan di sepanjang jalan yang berdebu dan tandus di hari yang sangat panas. Tidak lama kemudian, mereka menemukan sebuah pohon besar. </s>"
- text: "question: Siapa pemimpin Kerajaan Tarumanegara? context: Raja Purnawarman mulai memerintah Kerajaan Tarumanegara pada tahun 395 M. </s>"
    
license: mit
---

# idT5 for Indonesian Question Generation and Question Answering

[idT5](https://huggingface.co/muchad/idt5-base) (Indonesian version of [mT5](https://huggingface.co/google/mt5-base)) is fine-tuned on 30% of [translated SQuAD v2.0](https://github.com/Wikidepia/indonesian_datasets/tree/master/question-answering/squad) for **Question Generation** and **Question Answering** tasks.

## Live Demo
* **Question Generation:** [ai.muchad.com/qg](https://ai.muchad.com/qg/)
* **Question Answering:** [t.me/caritahubot](https://t.me/caritahubot)

## Requirements
```
!pip install transformers==4.4.2
!pip install sentencepiece==0.1.95
!git clone https://github.com/muchad/qaqg.git
%cd qaqg/
```

## Usage 🚀
#### Question Generation
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/muchad/qaqg/blob/main/idT5_Question_Generation.ipynb)

```
from pipeline_qg import pipeline #pipeline_qg.py script in the cloned repo
qg = pipeline()

#sample
qg("Raja Purnawarman mulai memerintah Kerajaan Tarumanegara pada tahun 395 M.")

#output
=> [{'answer': 'Raja Purnawarman','question': 'Siapa yang memerintah Kerajaan Tarumanegara?'}, {'answer': '395 M','question': 'Kapan Raja Purnawarman memerintah Kerajaan Tarumanegara?'}]
```


#### Question Answering

[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/muchad/qaqg/blob/main/idT5_Question_Answering.ipynb)

```
from pipeline_qa import pipeline #pipeline_qa.py script in the cloned repo
qa = pipeline()

#sample
qa({"context":"Raja Purnawarman mulai memerintah Kerajaan Tarumanegara pada tahun 395 M.","question":"Siapa pemimpin Kerajaan Tarumanegara?"})

#output
=> Raja Purnawarman
```