Upload README.md with huggingface_hub

#1
by lbourdois - opened
Files changed (1) hide show
  1. README.md +1 -39
README.md CHANGED
@@ -1,41 +1,3 @@
1
  ---
2
- tags:
3
- - question-generation
4
- - question-answering
5
- language:
6
- - thai
7
- - th
8
- datasets:
9
- - NSC2018
10
- - iapp-wiki-qa-dataset
11
- - XQuAD
12
- license: mit
13
  ---
14
-
15
- [Google's mT5](https://github.com/google-research/multilingual-t5)
16
-
17
- This is a model for generating questions from Thai texts. It was fine-tuned on NSC2018 corpus
18
-
19
- ```python
20
- from transformers import MT5Tokenizer, MT5ForConditionalGeneration
21
-
22
- tokenizer = MT5Tokenizer.from_pretrained("Pollawat/mt5-small-thai-qa-qg")
23
- model = MT5ForConditionalGeneration.from_pretrained("Pollawat/mt5-small-thai-qa-qg")
24
-
25
- text = "กรุงเทพมหานคร เป็นเมืองหลวงและนครที่มีประชากรมากที่สุดของประเทศไทย เป็นศูนย์กลางการปกครอง การศึกษา การคมนาคมขนส่ง การเงินการธนาคาร การพาณิชย์ การสื่อสาร และความเจริญของประเทศ เป็นเมืองที่มีชื่อยาวที่สุดในโลก ตั้งอยู่บนสามเหลี่ยมปากแม่น้ำเจ้าพระยา มีแม่น้ำเจ้าพระยาไหลผ่านและแบ่งเมืองออกเป็น 2 ฝั่ง คือ ฝั่งพระนครและฝั่งธนบุรี กรุงเทพมหานครมีพื้นที่ทั้งหมด 1,568.737 ตร.กม. มีประชากรตามทะเบียนราษฎรกว่า 5 ล้านคน"
26
-
27
- input_ids = tokenizer.encode(text, return_tensors='pt')
28
-
29
- beam_output = model.generate(
30
- input_ids,
31
- max_length=50,
32
- num_beams=5,
33
- early_stopping=True
34
- )
35
-
36
- print(tokenizer.decode(beam_output[0]))
37
- >> <pad> <extra_id_0> แม่น้ําเจ้าพระยาไหลผ่านและแบ่งเมืองออกเป็น 2 ฝั่ง คือ ฝั่งใด <ANS> ฝั่งพระนครและฝั่งธนบุรี</s>
38
-
39
- print(tokenizer.decode(beam_output[0], skip_special_tokens=True))
40
- >> <extra_id_0> แม่น้ําเจ้าพระยาไหลผ่านและแบ่งเมืองออกเป็น 2 ฝั่ง คือ ฝั่งใด ฝั่งพระนครและฝั่งธนบุรี
41
- ```
1
  ---
2
+ language: th
 
 
 
 
 
 
 
 
 
 
3
  ---