pegasus-x-thai-sum / README.md
satjawat's picture
Update README.md
121a293 verified
metadata
language:
  - th
pipeline_tag: summarization
tags:
  - summarization
  - pegasus_x
widget:
  - text: >-
      หลังจากมีการทดสอบนับหลายร้อยครั้งเพื่อตรวจสอบการปรากฏตัวของเขม่าดำหรือมลพิษอื่นๆ
      ตามแนวเทือกเขาแอนดีส ที่ตั้งขนานทอดยาวประมาณ 7,000
      กิโลเมตรไปตามแนวชายฝั่งตะวันตกของละตินอเมริกา ล่าสุด
      ผู้เชี่ยวชาญด้านสิ่งแวดล้อมจากมหาวิทยาลัยซานติอาโก ในประเทศชิลี เผยว่า
      หิมะที่ปกคลุมเทือกเขาแอนดีสน่าจะมีความสะอาดพอๆกันกับหิมะในแถบอาร์กติกของประเทศแคนาดา,การวิจัยดังกล่าวเป็นส่วนหนึ่งของโครงการตรวจสอบการปรากฏตัวของเขม่าคาร์บอนสีดำหรือเขม่าดำ
      (black carbon) ในดินแดนที่เรียกว่า หิมะภาค (cryosphere)
      ซึ่งเป็นพื้นที่ส่วนหนึ่งของโลกที่มีทั้งหิมะและน้ำแข็งอยู่ใต้ผิวโลกและบนผิวโลก
      พื้นที่เย็นยะเยือกที่เต็มไปด้วยหิมะของเทือกเขาแอนดีสก็จัดว่าเป็นหิมะภาคแห่งหนึ่ง
      นักวิจัยพบว่าที่แห่งนี้มีเขม่าดำในปริมาณต่ำกว่า 14 นาโนกรัมต่อหิมะ 1 กรัม
      บ่งชี้ว่าอัตราส่วนเปรียบเทียบค่าการสะท้อนแสงของพื้นผิวกับปริมาณรังสีทั้งหมดที่ตกกระทบของหิมะมีน้อยกว่า
      2%
      เปรียบเทียบแล้วก็นับว่าอยู่ในระดับเดียวกับหิมะในแถบรัฐอลาสกาของสหรัฐอเมริกา
      หรือพื้นที่อาร์กติกในแคนาดา,ทั้งนี้
      เขม่าดำนั้นถูกปล่อยออกมาจากการเผาไหม้ของน้ำมัน ดีเซล เชื้อเพลิงจากไม้
      และเชื้อเพลิงจากซากดึกดำบรรพ์หรือฟอสซิล (fossil)
      เป็นตัวที่ทำให้พื้นผิวหิมะหม่นดำและความสามารถในการสะท้อนแสงของพื้นผิวลดต่ำลง
      นั่นหมายความว่าหิมะจะละลายเร็วขึ้น
      ซึ่งการศึกษาความเข้มข้นของเขม่าดำอาจมีความสำคัญต่อการคาดการณ์อัตราการละลายของหิมะและน้ำแข็งในอนาคตได้.
    example_title: Test

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

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 ThaiSum, 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.

Citation

If you use "satjawat/pegasus-x-thai-sum" in your project or publication, please cite the model as follows:

ปรีชานนท์ ชาติไทย และ สัจจวัจน์ ส่งเสริม. (2567),
การสรุปข้อความข่าวภาษาไทยด้วยโครงข่ายประสาทเทียม (Thai News Text Summarization Using Neural Network),
วิทยาศาสตรบัณฑิต (วทบ.):ขอนแก่น, มหาวิทยาลัยขอนแก่น