模型:

SEBIS/code_trans_t5_small_commit_generation

英文

CodeTrans模型用于生成git提交消息

以t5 small模型架构对git提交进行预训练的模型。首次发布于 this repository 。该模型是基于标记化的git提交进行训练的:在处理标记化的git提交时效果最佳。

模型说明

这个CodeTrans模型基于t5-small模型。它有自己的SentencePiece词汇模型。它在Git提交消息生成数据集上进行了单任务训练。

使用目的和限制

该模型可用于生成git提交改动的提交消息,或者对其他相关任务进行微调。它可以用于未解析和未标记化的提交改动。然而,如果改动已经标记化,性能会更好。

如何使用

使用Transformers SummarizationPipeline生成git提交消息的示例:

from transformers import AutoTokenizer, AutoModelWithLMHead, SummarizationPipeline

pipeline = SummarizationPipeline(
    model=AutoModelWithLMHead.from_pretrained("SEBIS/code_trans_t5_small_commit_generation"),
    tokenizer=AutoTokenizer.from_pretrained("SEBIS/code_trans_t5_small_commit_generation", skip_special_tokens=True),
    device=0
)

tokenized_code = "new file mode 100644 index 000000000 . . 892fda21b Binary files / dev / null and b / src / plugins / gateway / lib / joscar . jar differ"
pipeline([tokenized_code])

在 colab notebook 中运行此示例。

训练数据

监督训练任务数据集可以在 Link 中下载。

评估结果

对于git提交消息生成任务,不同模型在不同编程语言上达到的结果如下(以BLEU得分表示):

测试结果:

Language / Model Java
CodeTrans-ST-Small 39.61
CodeTrans-ST-Base 38.67
CodeTrans-TF-Small 44.22
CodeTrans-TF-Base 44.17
CodeTrans-TF-Large 44.41
CodeTrans-MT-Small 36.17
CodeTrans-MT-Base 39.25
CodeTrans-MT-Large 41.18
CodeTrans-MT-TF-Small 43.96
CodeTrans-MT-TF-Base 44.19
CodeTrans-MT-TF-Large 44.34
State of the art 32.81

由 Ahmed Elnaggar | LinkedIn 和Wei Ding | LinkedIn 创建。