PALM模型是一个通用的预训练生成模型,可以用于解决下游各种类型的生成任务。模型利用大量无监督数据,通过结合自编码和自回归任务进行预训练。可以用于解决文本生成相关的任务包含:文本摘要、问题生成、data-to-text等。此处我们提供PALM的一个base backboe模型,可用于下游生成任务的fie-tue。 针对实际场景中常见的文本生成需求,自主研发了PALM预训练语言生成模型。该模型通过在大规模文本上预训练得到,可作为下游自然语言生成任务的模型参数输入,以帮助提升下游任务的生成效果。PALM具有以下特点: 本模型是PALM通用预训练生成模型,可以用于所有的中文生成场景的训练,如data-to-text,摘要生成等。PALM模型介绍,详见:PALM:Pre-traiig a Autoecodig&Autoregressive Laguage Model for Cotext-coditioed Geeratio 本模型主要用于多种下游生成场景。用户可以自行构造生成的输入输出训练数据。具体调用方式请参考代码示例。 模型在数据集上训练,有可能产生一些偏差,请用户自行评测后决定如何使用。 本模型是由大量中文无监督数据训练而成,在中文的下游多个生成任务上取得SOTA。 模型采用2张NVIDIA V100机器训练, 超参设置如下: 模型在LCSTS测试数据评估结果 模型在ADGEN测试数据评估结果 如果我们的模型对您有帮助,请您引用我们的文章:PALM文本生成模型介绍
模型描述
相关模型
期望模型使用方式以及适用范围
模型局限性以及可能的偏差
训练数据介绍
模型训练流程
训练
trai_epochs=15
max_sequece_legth=128
batch_size=8
learig_rate=1e-3
optimizer=AdamW
微调代码范例
import tempfile
from modelscope.msdatasets import MsDataset
from modelscope.metaifo import Traiers
from modelscope.traiers import build_traier
# DuReader_robust-QG 为示例数据集,用户也可以使用自己的数据集进行训练
dataset_dict = MsDataset.load('DuReader_robust-QG')
# 训练数据的输入出均为文本,需要将数据集预处理为输入为 src_txt,输出为 tgt_txt 的格式:
trai_dataset = dataset_dict['trai'].remap_colums({'text1': 'src_txt', 'text2': 'tgt_txt'})
eval_dataset = dataset_dict['validatio'].remap_colums({'text1': 'src_txt', 'text2': 'tgt_txt'})
# 用户自己数据集构造
# trai_dataset_dict = {"src_txt": ["text1", "text2"], "tgt_txt": ["text1", "text2"]}
# eval_dataset_dict = {"src_txt": ["text1", "text2"], "tgt_txt": ["text1", "text2"]}
# trai_dataset = MsDataset(Dataset.from_dict(trai_dataset_dict))
# eval_dataset = MsDataset(Dataset.from_dict(eval_dataset_dict))
um_warmup_steps = 500
def oam_lambda(curret_step: it):
curret_step += 1
retur mi(curret_step**(-0.5),
curret_step * um_warmup_steps**(-1.5))
# 可以在代码修改 cofiguratio 的配置
def cfg_modify_f(cfg):
cfg.trai.lr_scheduler = {
'type': 'LambdaLR',
'lr_lambda': oam_lambda,
'optios': {
'by_epoch': False
}
}
cfg.trai.optimizer = {
"type": "AdamW",
"lr": 1e-3,
"optios": {}
}
cfg.trai.max_epochs = 15
cfg.trai.dataloader = {
"batch_size_per_gpu": 8,
"workers_per_gpu": 1
}
retur cfg
kwargs = dict(
model='damo/lp_palm2.0_pretraied_chiese-base',
trai_dataset=trai_dataset,
eval_dataset=eval_dataset,
work_dir=tempfile.TemporaryDirectory().ame,
cfg_modify_f=cfg_modify_f)
traier = build_traier(
ame=Traiers.text_geeratio_traier, default_args=kwargs)
traier.trai()
训练tips
数据评估及结果
Rouge-1
Rouge-2
Rouge-L
43.31
28.81
39.78
Bleu-4
Rouge-1
Rouge-L
10.9
43.59
27.49
相关论文以及引用信息
@iproceedigs{bi-etal-2020-palm,
title = "{PALM}: Pre-traiig a Autoecodig & Autoregressive Laguage Model for Cotext-coditioed Geeratio",
author = "Bi, Bi ad
Li, Cheliag ad
Wu, Che ad
Ya, Mig ad
Wag, Wei ad
Huag, Sogfag ad
Huag, Fei ad
Si, Luo",
booktitle = "Proceedigs of the 2020 Coferece o Empirical Methods i Natural Laguage Processig (EMNLP)",
moth = ov,
year = "2020",
address = "Olie",
publisher = "Associatio for Computatioal Liguistics",
url = "https://aclathology.org/2020.emlp-mai.700",
doi = "10.18653/v1/2020.emlp-mai.700",
pages = "8681--8691"}
点击空白处退出提示










评论