Views
No views yet
ThaiT5-Instruct is a fine-tuned version of kobkrit/thai-t5-base, trained on the WangchanX Seed-Free Synthetic Instruct Thai 120k dataset. This model supports various NLP tasks, including:kobkrit/thai-t5-base13322A100[2.2463, 1.7010, 1.5261, 1.4626, 1.4085, 1.3844, 1.3647, 1.3442, 1.3373, 1.3182, 1.3169, 1.3016][1.4781, 1.3761, 1.3131, 1.2775, 1.2549, 1.2364, 1.2226, 1.2141, 1.2043, 1.1995, 1.1954, 1.1929]| Metric | Score |
|---|---|
| ROUGE-1 | 0.0617 |
| ROUGE-2 | 0.0291 |
| ROUGE-L | 0.061 |
| BLEU | 0.0093 |
| Exact Match | 0.2516 |
| F1 Score | 27.8984 |
1from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
2
3model = AutoModelForSeq2SeqLM.from_pretrained("Peenipat/ThaiT5-Instruct", trust_remote_code=True)
4tokenizer = AutoTokenizer.from_pretrained("Peenipat/ThaiT5-Instruct")
5
6input_text = "หวัดดี"
7
8inputs = tokenizer(input_text, return_tensors="pt")
9outputs = model.generate(input_ids=inputs["input_ids"])
10output_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
11
12print(output_text)1input_text = "คำว่า ฮัก หมายถึงอะไร"
2
3inputs = tokenizer(input_text, return_tensors="pt")
4outputs = model.generate(input_ids=inputs["input_ids"])
5output_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
6
7print(output_text)"ฮัก หมายถึง ภาษา สันสกฤต ภาษา สันสกฤต "1from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, pipeline
2
3model = AutoModelForSeq2SeqLM.from_pretrained("Peenipat/ThaiT5-Instruct", trust_remote_code=True)
4tokenizer = AutoTokenizer.from_pretrained("Peenipat/ThaiT5-Instruct")
5
6model.eval()
7qa_pipeline = pipeline("text2text-generation", model=model, tokenizer=tokenizer)
8
9def ask_question():
10 context = input("Input Context: ")
11 question = input("Input Question: ")
12 input_text = f"Context: {context} Question: {question}"
13 output = qa_pipeline(input_text,
14 max_length=60,
15 min_length=20,
16 no_repeat_ngram_size=3,
17 num_beams=5,
18 early_stopping=True)
19 output_text = output[0]['generated_text']
20 print("\nOutput:")
21 print(output_text)Input Context: ฮัก คือความรู้สึกผูกพันและห่วงใยที่เกิดขึ้นระหว่างคนที่มีความสำคัญต่อกัน ไม่ว่าจะเป็นฮักหนุ่มสาว ฮักพ่อแม่ลูก หรือฮักพี่น้อง ฮักบ่ได้หมายถึงแค่ความสุข แต่ยังรวมถึงความเข้าใจ การอดทน และการเสียสละเพื่อกันและกัน คนอีสานมักแสดงความฮักผ่านการกระทำมากกว่าคำพูด เช่น การดูแลเอาใจใส่ และการอยู่เคียงข้างยามทุกข์ยาก ฮักแท้คือฮักที่มั่นคง บ่เปลี่ยนแปลงตามกาลเวลา และเต็มไปด้วยความจริงใจ
Input Question: คำว่า ฮัก หมายถึงอะไร
Output:
ฮัก ความรู้สึกผูกพันและห่วงใย เกิดขึ้นระหว่างคนมีความสําคัญต่อกัน ฮักบ่ได้หมายถึงความสุข ความเข้าใจ การอดทน เสียสละเพื่อกันและกัน คนอีสานมักแสดงความฮักผ่านการกระทํามากกว่าคําพูด ดูแลเอาใจใส่ ที่อยู่เคียงข้างยามทุกข์1@misc{PeenipatThaiT5Instruct,
2 title={ThaiT5-Instruct},
3 author={Peenipat},
4 year={2025},
5 publisher={Hugging Face},
6 url={https://huggingface.co/Peenipat/ThaiT5-Instruct}
7}