语言:
- 印度尼西亚语
许可证: Apache-2.0
库名称: transformers
标签:
- 源自Keras回调生成
数据集:
- csebuetnlp/xlsum
- id_liputan6
评估指标:
- ROUGE
流水线标签: 文本摘要
基础模型: pegasus_indonesian_base-pretrain
模型索引:
- 名称: pegasus_indonesian_base-finetune
结果: []
pegasus_indonesian_base-finetune
GitHub仓库: PEGASUS TPU训练器
本模型是在Indosum、Liputan6和XLSum数据集上对pegasus_indonesian_base-pretrain进行微调的版本。
快速体验模型请访问此Colab笔记本。
使用范围与限制
该模型为无大小写敏感模型,除","和"."外无法识别特殊字符,在非新闻类文本上表现可能欠佳。
性能表现
数据集 |
ROUGE-1 |
ROUGE-2 |
ROUGE-L |
BERTScore |
Indosum |
52.43 |
41.23 |
48.18 |
80.68 |
Liputan6 |
38.27 |
20.22 |
31.26 |
76.31 |
XLSum |
26.97 |
9.99 |
21.70 |
73.62 |
训练与评估数据
微调数据集:
- Indosum
- Liputan6
- XLSum
使用示例
from transformers import TFPegasusForConditionalGeneration, PegasusTokenizerFast
model_name = "thonyyy/pegasus_indonesian_base-finetune"
model = TFPegasusForConditionalGeneration.from_pretrained(model_name)
tokenizer = PegasusTokenizerFast.from_pretrained(model_name)
import re
import unicodedata
def text_cleaning(input_string):
lowercase = input_string.lower()
remove_link = re.sub(r'(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w\.-]*)', '', lowercase).replace("&","&")
remove_bullet = "\n".join([T for T in remove_link.split('\n') if '•' not in T and "baca juga:" not in T])
remove_accented = unicodedata.normalize('NFKD', remove_bullet).encode('ascii', 'ignore').decode('utf-8', 'ignore')
remove_parentheses = re.sub("([\(\|]).*?([\)\|])", "\g<1>\g<2>", remove_accented)
remove_punc = re.sub(r"[^\w\d.\s]+",' ', remove_parentheses)
remove_num_dot = re.sub(r"(?<=\d)\.|\.(?=\d)|(?<=#)\.","", remove_punc)
remove_extra_whitespace = re.sub(r'^\s*|\s\s*', ' ', remove_num_dot).strip()
return ".".join([s for s in remove_extra_whitespace.strip().split('.') if len(s.strip())>10]).replace("_","")
sample_article="""
国际货币基金组织(IMF)评估印尼通过稳健的宏观经济表现展现出良好的疫情后经济复苏态势,这得益于审慎实施的货币与财政政策。前瞻性与协同性政策使印尼在2022年成功应对全球挑战,实现健康增长、通胀压力下降和金融体系稳定。印尼央行对IMF在2023年第四条磋商报告中提出的评估结果表示欢迎(6月26日发布)。
IMF执行董事会高度认可印尼当局2022年采取的各项政策:一是财政赤字率快速恢复至3%上限;二是实施适度的物价稳定货币政策;三是保持金融部门韧性;四是通过《就业创造法》和《金融业发展与强化法案》确保改革势头延续;五是聚焦下游化的出口增值战略;六是承诺减少温室气体排放和森林砍伐。
"""
x = tokenizer(text_cleaning(sample_article), return_tensors = 'tf')
y = model.generate(**x)
summary = tokenizer.batch_decode(y, skip_special_tokens=True)
print(summary)
训练流程
完整复现方法请参见GitHub页面
训练超参数
训练采用以下超参数配置:
- 优化器: {'name': 'Adafactor', 'weight_decay': None, 'clipnorm': None, 'global_clipnorm': None, 'clipvalue': None, 'use_ema': False, 'ema_momentum': 0.99, 'ema_overwrite_frequency': None, 'jit_compile': False, 'is_legacy_optimizer': False, 'learning_rate': 0.00013661868, 'beta_2_decay': -0.8, 'epsilon_1': 1e-30, 'epsilon_2': 0.001, 'clip_threshold': 1.0, 'relative_step': True}
- 训练精度: float32
训练结果
训练损失 |
训练准确率 |
验证损失 |
验证准确率 |
学习率 |
周期 |
2.3484 |
0.0859 |
1.6304 |
0.1080 |
0.00013661868 |
1 |
1.6196 |
0.1079 |
1.4097 |
0.1153 |
0.00013661868 |
2 |
框架版本
- Transformers 4.30.2
- TensorFlow 2.12.0
- Datasets 2.13.1
- Tokenizers 0.13.3
特别致谢
本研究使用Google TPU研究云(TRC)提供的Cloud TPU完成