{"id":13726529,"url":"https://github.com/graykode/commit-autosuggestions","last_synced_at":"2025-04-04T19:12:18.633Z","repository":{"id":37624030,"uuid":"290576323","full_name":"graykode/commit-autosuggestions","owner":"graykode","description":"A tool that AI automatically recommends commit messages.","archived":false,"fork":false,"pushed_at":"2023-08-08T22:06:35.000Z","size":55196,"stargazers_count":387,"open_issues_count":4,"forks_count":17,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-28T18:12:39.336Z","etag":null,"topics":["bert","commit-autosuggestions","natural-language","nlp","text-generation"],"latest_commit_sha":null,"homepage":"https://arxiv.org/abs/2105.14242","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/graykode.png","metadata":{"files":{"readme":"README.md","changelog":"change_logs/v0.1.0.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":"graykode","custom":["https://www.paypal.me/graykode","https://www.buymeacoffee.com/graykode"]}},"created_at":"2020-08-26T18:37:19.000Z","updated_at":"2025-03-12T19:35:33.000Z","dependencies_parsed_at":"2024-01-10T19:10:48.025Z","dependency_job_id":null,"html_url":"https://github.com/graykode/commit-autosuggestions","commit_stats":{"total_commits":92,"total_committers":2,"mean_commits":46.0,"dds":"0.010869565217391353","last_synced_commit":"2bc18fdbdcc38d3e5b77fc3471fcd860b3057e89"},"previous_names":["graykode/autocommit"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graykode%2Fcommit-autosuggestions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graykode%2Fcommit-autosuggestions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graykode%2Fcommit-autosuggestions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graykode%2Fcommit-autosuggestions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/graykode","download_url":"https://codeload.github.com/graykode/commit-autosuggestions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247234922,"owners_count":20905854,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bert","commit-autosuggestions","natural-language","nlp","text-generation"],"created_at":"2024-08-03T01:03:10.684Z","updated_at":"2025-04-04T19:12:13.624Z","avatar_url":"https://github.com/graykode.png","language":"Python","funding_links":["https://github.com/sponsors/graykode","https://www.paypal.me/graykode","https://www.buymeacoffee.com/graykode"],"categories":["Python"],"sub_categories":[],"readme":"# commit-autosuggestions\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://travis-ci.com/github/graykode/commit-autosuggestions\"\u003e\u003cimg alt=\"Build Status\" src=\"https://travis-ci.com/graykode/commit-autosuggestions.svg?branch=master\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/graykode/commit-autosuggestions/blob/master/LICENSE\"\u003e\u003cimg alt=\"License: Apache 2.0\" src=\"https://img.shields.io/badge/License-Apache%202.0-blue.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://pypi.org/project/commit/\"\u003e\u003cimg alt=\"PyPI\" src=\"https://img.shields.io/pypi/v/commit\"\u003e\u003c/a\u003e\n\u003ca href=\"https://pepy.tech/project/commit\"\u003e\u003cimg alt=\"Downloads\" src=\"https://static.pepy.tech/badge/commit\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nThis is implementation of [CommitBERT: Commit Message Generation Using Pre-Trained Programming Language Model](https://arxiv.org/abs/2105.14242). CommitBERT is accepted in ACL workshop : NLP4Prog.\nHave you ever hesitated to write a commit message? Now get a commit message from Artificial Intelligence!\n\n\u003cdiv align=\"center\"\u003e\n\u003cspan align=\"left\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/graykode/commit-autosuggestions/master/images/python.gif\" weight=\"380px\" height=\"270px\" /\u003e\u003c/span\u003e\n  \u003cspan align=\"right\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/graykode/commit-autosuggestions/master/images/javascript.gif\" weight=\"380px\" height=\"270px\" /\u003e\u003c/span\u003e\n\u003c/div\u003e\n\n### Abstract\n[CodeBERT: A Pre-Trained Model for Programming and Natural Languages](https://arxiv.org/pdf/2002.08155.pdf) introduces a pre-trained model in a combination of Program Language and Natural Language(PL-NL). It also introduces the problem of converting code into natural language (Code Documentation Generation).\n```text\ndiff --git a/test.py b/test.py\nnew file mode 100644\nindex 0000000..d13f441\n--- /dev/null\n+++ b/test.py\n@@ -0,0 +1,6 @@\n+\n+import torch\n+import argparse\n+\n+def add(a, b):\n+    return a + b\n```\n```text\nRecommended Commit Message : Add two arguments .\n```\nWe can use CodeBERT to create a model that generates a commit message when code is added. However, most code changes are not made only by add of the code, and some parts of the code are deleted.\n```text\ndiff --git a/test.py b/test.py\nindex d13f441..1b1b82a 100644\n--- a/test.py\n+++ b/test.py\n@@ -1,6 +1,3 @@\n\n-import torch\n-import argparse\n-\n def add(a, b):\n     return a + b\n```\n```text\nRecommended Commit Message : Remove unused imports\n```\nTo solve this problem, use a new embedding called [`patch_type_embeddings`](https://github.com/graykode/commit-autosuggestions/blob/master/commit/model/diff_roberta.py#L40) that can distinguish added and deleted, just as the XLM(Lample et al, 2019) used language embeddeding. (1 for added, 2 for deleted.)\n\n### Language support\n| Language       | Added | Diff |  Data(Only Diff) | Weights |\n| :------------- | :---: | :---:| :---: | :---:|\n| Python         | ✅    | ✅   | [423k](https://drive.google.com/drive/folders/1_8lQmzTH95Nc-4MKd1RP3x4BVc8tBA6W?usp=sharing) |  [Link](https://drive.google.com/drive/folders/1OwM7_FiLiwVJAhAanBPWtPw3Hz3Dszbh?usp=sharing)  |\n| JavaScript     | ✅    | ✅   | [514k](https://drive.google.com/drive/folders/1-Hv0VZWSAGqs-ewNT6NhLKEqDH2oa1az?usp=sharing) |  [Link](https://drive.google.com/drive/folders/1Jw8vXfxUXsfElga_Gi6e7Uhfc_HlmOuD?usp=sharing)  |\n| Go             | ⬜    | ⬜   | ⬜ |  ⬜  |\n| JAVA           | ⬜    | ⬜   | ⬜ |  ⬜  |\n| Ruby           | ⬜    | ⬜   | ⬜ |  ⬜  |\n| PHP            | ⬜    | ⬜   | ⬜ |  ⬜  |\n* ✅ — Supported\n* ⬜ - N/A ️\n\nWe plan to slowly conquer languages that are not currently supported. However, I also need to use expensive GPU instances of AWS or GCP to train about the above languages. Please do a simple sponsor for this! Add data is [CodeSearchNet dataset](https://drive.google.com/uc?id=1rd2Tc6oUWBo7JouwexW3ksQ0PaOhUr6h).\n\n### Quick Start\nTo run this project, you need a flask-based inference server (GPU) and a client (commit module). If you don't have a GPU, don't worry, you can use it through Google Colab.\n\n#### 1. Run flask pytorch server.\nPrepare Docker and Nvidia-docker before running the server.\n\n##### 1-a. If you have GPU machine.\nServe flask server with Nvidia Docker. Check the docker tag for programming language in [here](https://hub.docker.com/repository/registry-1.docker.io/graykode/commit-autosuggestions/tags).\n| Language       | Tag   |\n| :------------- | :---: |\n| Python         | py    |\n| JavaScript     | js    |\n| Go             | go    |\n| JAVA           | java  |\n| Ruby           | ruby  |\n| PHP            | php   |\n\n```shell script\n$ docker run -it -d --gpus 0 -p 5000:5000 graykode/commit-autosuggestions:{language}\n```\n\n##### 1-b. If you don't have GPU machine.\nEven if you don't have a GPU, you can still serve the flask server by using the ngrok setting in [commit_autosuggestions.ipynb](commit_autosuggestions.ipynb).\n\n#### 2. Start commit autosuggestion with Python client module named `commit`.\nFirst, install the package through pip.\n```shell script\n$ pip install commit\n```\n\nSet the endpoint for the flask server configured in step 1 through the commit configure command. (For example, if the endpoint is http://127.0.0.1:5000, set it as follows: `commit configure --endpoint http://127.0.0.1:5000`)\n```shell script\n$ commit configure --help       \nUsage: commit configure [OPTIONS]\n\nOptions:\n  --profile TEXT   unique name for managing each independent settings\n  --endpoint TEXT  endpoint address accessible to the server (example :\n                   http://127.0.0.1:5000/)  [required]\n\n  --help           Show this message and exit.\n```\n\nAll setup is done! Now, you can get a commit message from the AI with the command commit.\n\n```shell script\n$ commit --help          \nUsage: commit [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  --profile TEXT       unique name for managing each independent settings\n  -f, --file FILENAME  patch file containing git diff (e.g. file created by\n                       `git add` and `git diff --cached \u003e test.diff`)\n\n  -v, --verbose        print suggested commit message more detail.\n  -a, --autocommit     automatically commit without asking if you want to\n                       commit\n\n  --help               Show this message and exit.\n\nCommands:\n  configure\n```\n\n### Training detail\nRefer [How to train for your lint style](docs/training.md). This allows you to re-fine tuning to your repository's commit lint style.\n\n### Contribution\nYou can contribute anything, even a typo or code in the article. Don't hesitate!!.\nVersions are managed only within the branch with the name of each version. After being released on Pypi, it is merged into the master branch and new development proceeds in the upgraded version branch.\n\n### Author\n[Tae Hwan Jung(@graykode)](https://github.com/graykode)\n\n### Citation\n```\n@article{jung2021commitbert,\n  title={CommitBERT: Commit Message Generation Using Pre-Trained Programming Language Model},\n  author={Jung, Tae-Hwan},\n  journal={arXiv preprint arXiv:2105.14242},\n  year={2021}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraykode%2Fcommit-autosuggestions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgraykode%2Fcommit-autosuggestions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraykode%2Fcommit-autosuggestions/lists"}