Update README.md
Browse files
README.md
CHANGED
@@ -1,33 +1,78 @@
|
|
1 |
---
|
2 |
-
license: apache-2.0
|
3 |
tags:
|
4 |
-
-
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
8 |
---
|
9 |
|
10 |
<!-- This model card has been generated automatically according to the information Keras had access to. You should
|
11 |
probably proofread and complete it, then remove this comment. -->
|
12 |
|
13 |
-
#
|
14 |
|
15 |
This model is a fine-tuned version of [google/mt5-small](https://huggingface.co/google/mt5-small) on an [csebuetnlp/xlsum](https://huggingface.co/datasets/csebuetnlp/xlsum) dataset.
|
16 |
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
-
The following hyperparameters were used during training:
|
20 |
-
- optimizer: {'name': 'AdamWeightDecay', 'learning_rate': 2e-05, 'decay': 0.0, 'beta_1': 0.9, 'beta_2': 0.999, 'epsilon': 1e-07, 'amsgrad': False, 'weight_decay_rate': 0.01}
|
21 |
- training_precision: float32
|
22 |
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
|
|
|
|
|
|
29 |
|
30 |
-
|
31 |
|
32 |
- Transformers 4.19.2
|
33 |
- TensorFlow 2.8.0
|
|
|
1 |
---
|
|
|
2 |
tags:
|
3 |
+
- Summarization
|
4 |
+
- mT5
|
5 |
+
datasets:
|
6 |
+
- csebuetnlp/xlsum
|
7 |
+
language:
|
8 |
+
- id
|
9 |
+
license:
|
10 |
+
- apache-2.0
|
11 |
---
|
12 |
|
13 |
<!-- This model card has been generated automatically according to the information Keras had access to. You should
|
14 |
probably proofread and complete it, then remove this comment. -->
|
15 |
|
16 |
+
# mt5-small-indonesian-sum
|
17 |
|
18 |
This model is a fine-tuned version of [google/mt5-small](https://huggingface.co/google/mt5-small) on an [csebuetnlp/xlsum](https://huggingface.co/datasets/csebuetnlp/xlsum) dataset.
|
19 |
|
20 |
+
## Training results
|
21 |
+
|
22 |
+
| Train Loss | Validation Loss | Train Rouge1 | Train Rouge2 | Train Rougel | Train Rougelsum | Train Gen Len |
|
23 |
+
|:----------:|:---------------:|:------------:|:------------:|:------------:|:---------------:|:-------------:|
|
24 |
+
| 4.6665 | 2.6526 | 19.7876 | 6.6344 | 16.7880 | 16.8459 | 18.92 |
|
25 |
+
|
26 |
+
## Training hyperparameters
|
27 |
+
|
28 |
+
Optimizer | VALUE
|
29 |
+
---------|----------------------------
|
30 |
+
learning_rate| 2e-05
|
31 |
+
decay| 0.0
|
32 |
+
beta_1| 0.9
|
33 |
+
beta_2| 0.999
|
34 |
+
epsilon| 1e-07
|
35 |
+
amsgrad| False
|
36 |
+
weight_decay_rate| 0.01
|
37 |
|
|
|
|
|
38 |
- training_precision: float32
|
39 |
|
40 |
+
## Using this model in `transformers` (tested on 4.11.0.dev0)
|
41 |
+
|
42 |
+
```python
|
43 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
44 |
+
import re
|
45 |
+
|
46 |
+
news = """
|
47 |
+
Anggota Unit Perlindungan Rakyat Kurdi di kota Rabia, pada perbatasan Irak-Suriah. Pasukan Kurdi Irak dilaporkan sudah menguasai kembali kota Rabia meskipun banyak korban jatuh. Pejabat senior Kurdi Irak mengatakan pasukan Kurdi Peshmerga mencatat kemajuan lewat serangan dini hari di Rabia. Sementara itu, milisi ISIS berusaha memukul mundur pasukan Kurdi Suriah di bagian lain perbatasan. Hal ini terjadi saat koalisi pimpinan Amerika terus melanjutkan serangan udara terhadap sasaran ISIS di Suriah dan Irak. Hari Selasa (30 September) dilaporkan juga terjadi serangkaian serangan bom di ibu kota Irak, Baghdad dan kota suci Syiah, Karbala. Dalam perkembangan terpisah, sejumlah tank Turki berada di bukit di sepanjang perbatasan dekat kota Kobane, Suriah setelah sejumlah bom mengenai wilayah Turki saat terjadi bentrokan dengan milisi ISIS dan pejuang Kurdi. Pemerintah Turki diperkirakan akan menyampaikan mosi ke parlemen, agar menyetujui aksi militer terhadap ISIS di Irak dan Suriah.
|
48 |
+
"""
|
49 |
+
|
50 |
+
tokenizer = AutoTokenizer.from_pretrained("assamim/mt5-small-indonesian-sum")
|
51 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("assamim/mt5-small-indonesian-sum", from_tf=True)
|
52 |
+
|
53 |
+
|
54 |
+
WHITESPACE_HANDLER = lambda k: re.sub('\s+', ' ', re.sub('\n+', ' ', k.strip()))
|
55 |
|
56 |
+
input_ids = tokenizer.encode(WHITESPACE_HANDLER(news1), return_tensors='pt')
|
57 |
+
summary_ids = model.generate(input_ids,
|
58 |
+
min_length=20,
|
59 |
+
max_length=200,
|
60 |
+
num_beams=7,
|
61 |
+
repetition_penalty=2.5,
|
62 |
+
length_penalty=1.0,
|
63 |
+
early_stopping=True,
|
64 |
+
no_repeat_ngram_size=2,
|
65 |
+
use_cache=True,
|
66 |
+
do_sample = True,
|
67 |
+
temperature = 0.8,
|
68 |
+
top_k = 50,
|
69 |
+
top_p = 0.95)
|
70 |
|
71 |
+
summary_text = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
|
72 |
+
print(summary_text)
|
73 |
+
```
|
74 |
|
75 |
+
## Framework versions
|
76 |
|
77 |
- Transformers 4.19.2
|
78 |
- TensorFlow 2.8.0
|