这是使用预训练的编程语言模型的Prossbert:提交消息生成的实现。 ACL研讨会中接受了Prossbert:NLP4Prog。您是否曾经犹豫写一条提交消息?现在从人工智能中获取提交信息!
Codebert:用于编程和自然语言的预训练模型,在程序语言和自然语言(PL-NL)的结合使用中引入了预训练的模型。它还引入了将代码转换为自然语言(代码文档生成)的问题。
diff --git a/test.py b/test.py
new file mode 100644
index 0000000..d13f441
--- /dev/null
+++ b/test.py
@@ -0,0 +1,6 @@
+
+import torch
+import argparse
+
+def add(a, b):
+ return a + b
Recommended Commit Message : Add two arguments .
我们可以使用Codebert创建一个模型,该模型在添加代码时会生成提交消息。但是,大多数代码更改不仅是通过添加代码进行的,并且代码的某些部分被删除。
diff --git a/test.py b/test.py
index d13f441..1b1b82a 100644
--- a/test.py
+++ b/test.py
@@ -1,6 +1,3 @@
-import torch
-import argparse
-
def add(a, b):
return a + b
Recommended Commit Message : Remove unused imports
为了解决此问题,请使用一种称为patch_type_embeddings的新嵌入,可以区分添加和删除,就像XLM(Lample等,2019)使用的语言嵌入式一样。 (添加1,删除为2。)
| 语言 | 额外 | 差异 | 数据(仅差异) | 权重 |
|---|---|---|---|---|
| Python | ✅ | ✅ | 423k | 关联 |
| JavaScript | ✅ | ✅ | 514k | 关联 |
| 去 | ⬜ | ⬜ | ⬜ | ⬜ |
| 爪哇 | ⬜ | ⬜ | ⬜ | ⬜ |
| 红宝石 | ⬜ | ⬜ | ⬜ | ⬜ |
| php | ⬜ | ⬜ | ⬜ | ⬜ |
我们计划慢慢征服目前不支持的语言。但是,我还需要使用昂贵的AWS或GCP实例来培训上述语言。请为此做一个简单的赞助商!添加数据是codesearchnet数据集。
要运行此项目,您需要基于烧瓶的推理服务器(GPU)和客户端(提交模块)。如果您没有GPU,请放心,可以通过Google Colab使用它。
在运行服务器之前,请准备Docker和Nvidia-Docker。
用NVIDIA DOCKER服务烧瓶服务器。在此处检查Docker标签以获取编程语言。
| 语言 | 标签 |
|---|---|
| Python | py |
| JavaScript | JS |
| 去 | 去 |
| 爪哇 | 爪哇 |
| 红宝石 | 红宝石 |
| php | php |
$ docker run -it -d --gpus 0 -p 5000:5000 graykode/commit-autosuggestions:{language}即使您没有GPU,您仍然可以使用commit_autosuggestions.ipynb中的ngrok设置为烧瓶服务器服务。
commit的Python客户端模块开始提交autosuggestion。首先,通过PIP安装软件包。
$ pip install commit通过Commit Configure命令在步骤1中配置的烧瓶服务器的端点。 (例如,如果端点为http://127.0.0.1:5000,请将其设置为以下内容: commit configure --endpoint http://127.0.0.1:5000 )
$ commit configure --help
Usage: commit configure [OPTIONS]
Options:
--profile TEXT unique name for managing each independent settings
--endpoint TEXT endpoint address accessible to the server (example :
http://127.0.0.1:5000/) [required]
--help Show this message and exit.所有设置都完成了!现在,您可以使用命令提交从AI中获取提交消息。
$ commit --help
Usage: commit [OPTIONS] COMMAND [ARGS]...
Options:
--profile TEXT unique name for managing each independent settings
-f, --file FILENAME patch file containing git diff (e.g. file created by
` git add ` and ` git diff --cached > test.diff ` )
-v, --verbose print suggested commit message more detail.
-a, --autocommit automatically commit without asking if you want to
commit
--help Show this message and exit.
Commands:
configure参考如何训练您的棉绒风格。这使您可以重新提出调整存储库的提交棉绒样式。
您可以在文章中贡献任何内容,甚至可以贡献错别字或代码。不要犹豫!!版本仅在分支中以每个版本的名称进行管理。在PYPI上发布后,将其合并到主分支中,并在升级的版本分支中进行了新的开发项目。
Tae Hwan Jung(@graykode)
@article{jung2021commitbert,
title={CommitBERT: Commit Message Generation Using Pre-Trained Programming Language Model},
author={Jung, Tae-Hwan},
journal={arXiv preprint arXiv:2105.14242},
year={2021}
}