這是使用預訓練的編程語言模型的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}
}