pegasus-x-thai-sum / README.md
satjawat's picture
add credit (#1)
0b3aecb verified
|
raw
history blame
No virus
5.46 kB
---
language:
- th
pipeline_tag: summarization
tags:
- summarization
- pegasus_x
widget:
- text: >-
เมื่อวันที่ 27 ม.ค.67 ร.ต.อ.เกียรติศักดิ์ บุญญานุรักษ์ รอง สว.(สอบสวน) สภ.ท่าวุ้ง ลพบุรี ได้รับแจ้งอุบัติเหตุรถกระบะเฉี่ยวชนรถจักรยานยนต์ เหตุเกิดบนถนนสายลพบุรี-สิงห์บุรี
ระหว่างหลักกิโลเมตรที่ 22-23 หมู่ที่ 2 ต.บางงา อ.เมือง จ.ลพบุรี จึงเดินทางไปตรวจสอบ พร้อมเจ้าหน้าที่อาสาสมัครมูลนิธิร่วมกตัญญู
ที่เกิดเหตุพบรถยนต์กระบะ ยี่ห้อโตโยต้า 4 ประตู สีขาว ทะเบียนกรุงเทพมหานคร 1 คัน จอดอยู่กลางถนน ด้านหน้าขวามีร่องรอยการชนสภาพพังยับเยิน หน้ารถพบรถจักรยานยนต์
ยี่ห้อฮอนด้า สีชมพู-ขาว ทะเบียนสิงห์บุรี ล้มคว่ำคาหน้ารถกระบะ ห่างกันเล็กน้อยพบผู้บาดเจ็บสาหัส 2 ราย นอนอยู่กลางถนน เจ้าหน้าที่กู้ภัยฯเร่งปฐมพยาบาลช่วยเหลือ และรีบนำตัวส่ง รพ.ท่าวุ้ง
ก่อนเสียชีวิตในเวลาต่อมา ทราบชื่อผู้เสียชีวิต คือ นายนิคม เหมือนเมือง อายุ 47 ปี (คนขับ) ส่วนอีกรายคือ นายบุญส่ง เสียมสกุล อายุ 72 ปี (คนซ้อนท้าย) ทั้งคู่เป็นญาติกัน มีศักดิ์เป็นน้ากับหลาน
จากการสอบสวนทราบว่า ก่อนเกิดเหตุ นายบุญส่ง ได้วานให้ นายนิคม พาไปหาหมอ ที่ รพ.ท่าวุ้ง หลังหาหมอเสร็จ ได้ขับขี่รถจักรยานยนต์กลับบ้านวิ่งมาตามถนนสายลพบุรี-สิงห์บุรี
จนถึงจุดเกิดเหตุ มีรถกระบะตามหลังและขับแซงซ้ายมาด้วยความเร็วแต่แซงไม่พ้น ชนเสยท้ายรถจักรยานยนต์เต็มแรง แล้วลากรถจักรยานยนต์ไปไกลเป็นระยะทางยาวกว่า 50 เมตร
ส่วนคนขับรถกระบะอาศัยช่วงชุลมุนหลบหนีไป เบื้องต้น เจ้าหน้าที่ตำรวจจะเร่งตรวจสอบกล้องวงจรปิดตามเส้นทาง เพื่อติดคนขับรายนี้มาดำเนินคดีตามกฎหมายต่อไป [credit thairath]
example_title: Thai news
---
This repository features a fine-tuned Pegasus X model designed for summarizing Thai text. The architecture of the model is based on the Pegasus X model.
# Library
```
pip install transformers
```
# Example
```python
from transformers import PegasusXForConditionalGeneration, AutoTokenizer
model = PegasusXForConditionalGeneration.from_pretrained("satjawat/pegasus-x-thai-sum")
tokenizer = AutoTokenizer.from_pretrained("satjawat/pegasus-x-thai-sum")
new_input_string = "ข้อความ"
new_input_ids = tokenizer(new_input_string.lower(), return_tensors="pt").input_ids
summary_ids = model.generate(new_input_ids, max_length=50, num_beams=6, length_penalty=2.0, early_stopping=True)
summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
print("Input:", new_input_string)
print("Generated Summary:", summary)
```
# Training hyperparameters
The following hyperparameters were used during training:
- accumulation_steps: 2
- num_epochs: 20
- num_beams: 6
- learning_rate: lr=5e-5
- optimizer: AdamW with betas=(0.9,0.999) and epsilon=1e-08
- activation_function: gelu
- add_bias_logits: True
- normalize_embedding: True
- add_final_layer_norm: False
- normalize_before: False
# Score
Evaluate the model with the test dataset of <a href="https://github.com/nakhunchumpolsathien/ThaiSum">ThaiSum</a>, consisting of a total of 11,000 articles, with the following scores:
- Rouge1: 0.490279
- Rouge2: 0.289839
- Rougel: 0.489334
# Resource Funding
NSTDA Supercomputer center (ThaiSC) and the National e-Science Infrastructure Consortium for their support of computer facilities.