File size: 2,745 Bytes
88b0b43
 
 
 
 
 
 
 
ca9fb7b
 
 
 
 
 
 
 
 
 
 
 
88b0b43
 
 
 
 
 
 
 
 
 
dd1c3d4
88b0b43
dd1c3d4
88b0b43
 
dd1c3d4
88b0b43
 
 
 
 
 
ca9fb7b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
---
language:
- th
pipeline_tag: summarization
tags:
- summarization
- pegasus_x
---
widget:
  - text: >-
      ผมกินตับหมูดิบแล้วหมดสติไป พอฟื้นอีกทีในต่างโลกดันกลายเป็นหมูซะงั้น!
      คนที่ช่วยผมเอาไว้คือเจส สาวน้อยผู้อ่านใจคนได้ อู๊ด! น่ารัก!
      ระดับสายตาหมูทำให้เห็นอะไรสีขาวบริสุทธิ์แวบๆ แจ่มเลย... “เอ่อ
      ฉันได้ยินเสียงในใจของคุณนะคะ…” ฉิบแล้ว! ความมักมากรั่วไหลหมด!
      แม้ว่าชีวิตประสาหมูที่มีเด็กสาวผู้อ่อนโยนคอยดูแลจะไม่เลว
      ผมก็ตัดสินใจมุ่งหน้าสู่นครหลวงพร้อมกับเจสเพื่อหาทางกลับเป็นมนุษย์
      การเดินทางแสนรื่นรมย์จึงเริ่มต้นขึ้น...
      แต่ไหงเราถึงถูกตามล่าเอาชีวิตล่ะเนี่ย!?
    example_title: Novel

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:
<ul>
  <li>accumulation_steps:2</li>
  <li>num_epochs:20</li>
  <li>num_beams:6</li>
  <li>learning_rate:lr=5e-5</li>
  <li>activation_function:gelu</li>
  <li>add_bias_logits:True</li>
  <li>normalize_embedding:True</li>
  <li>add_final_layer_norm:False </li>
  <li>normalize_before:False</li>
</ul>