--- tags: - question-generation language: - thai - th datasets: - NSC2018 - wiki-documents-nsc - ThaiQACorpus-DevelopmentDataset widget: - text: "บุกยึดไม้เถื่อน อดีต ส.ส.บุรีรัมย์ เตรียมสร้างคฤหาสน์ทรงไทย 1 กันยายน 2550 12:00 น. ตำรวจภูธรจ.บุรีรัมย์บุกตรวจยึดไม้แปรรูปหวงห้ามกว่า 80 แผ่น" example_title: "ประโยค 1" - text: "Barack Obama nominated Hilary Clinton as his secretary of state on Monday. He chose her because she had ..." example_title: "Coreference resolution" - text: "On a shelf, there are five books: a gray book, a red book, a purple book, a blue book, and a black book ..." example_title: "Logic puzzles" - text: "The two men running to become New York City's next mayor will face off in their first debate Wednesday night ..." example_title: "Reading comprehension" license: mit --- [Pollawat](https://huggingface.co/Pollawat/mt5-small-thai-qg) [Google's mT5](https://github.com/google-research/multilingual-t5) ```python from transformers import T5Tokenizer, T5ForConditionalGeneration, T5Config model = T5ForConditionalGeneration.from_pretrained('SuperAI2-Machima/mt5-small-thai-qg') tokenizer = T5Tokenizer.from_pretrained('SuperAI2-Machima/mt5-small-thai-qg') source_text = 'บุกยึดไม้เถื่อน อดีต ส.ส.บุรีรัมย์ เตรียมสร้างคฤหาสน์ทรงไทย 1 กันยายน 2550 12:00 น. ตำรวจภูธรจ.บุรีรัมย์บุกตรวจยึดไม้แปรรูปหวงห้ามกว่า 80 แผ่น' print('Predicted Summary Text : ') tokenized_text = tokenizer.encode(source_text, return_tensors="pt").to(device) summary_ids = model.generate(tokenized_text, num_beams=4, no_repeat_ngram_size=2, max_length=50, early_stopping=True) output = tokenizer.decode(summary_ids[0], skip_special_tokens=True) print(output) #Predicted Summary Text : #answer: 80 แผ่น question: ตํารวจภูธรจ.บุรีรัมย์บุกตรวจยึดไม้แปรรูปหวงห้ามกว่ากี่แผ่น ```