Package: magic-commit
Magic Commit! ✨ 🍰magic-commitwrites your commit messages with AI.It's available as a command-line tool currently. There is an experimental VSCode extension in alpha, which you can read about inExperiments > VSCode Extensionbelow.Table of ContentsInstallationSetupUsageExperimentsVSCode ExtensionLlama2 ModelDeveloper NotesBuilding the Command-Line ToolBuilding the VSCode ExtensionPublishing to PyPIUnit TestsInstallationTo install the command-line tool,PyPIis the easiest way:pipinstallmagic-commitSetupYou'll need to set up an OpenAI account andget an API key.Once you have a key, add it tomagic-commitlike so:magic-commit-k<your-key-here>UsageRunningmagic-commitis straightforward:>>>magic-commit# will run in your current directory[yourcommitmessage]# automatically copied to your clipboardTo see all the options, run:>>>magic-commit--help

usage:magic-commit[-h][-dDIRECTORY][-mMODEL][-kAPI_KEY][--set-modelMODEL_NAME][--no-copy][--no-load][-tTICKET][-sSTART][--llamaLLAMA]GeneratecommitmessageswithOpenAI’sGPT.

optionalarguments:-h,--helpshowthishelpmessageandexit-dDIRECTORY,--directoryDIRECTORYSpecifythegitrepositorydirectory-mMODEL,--modelMODELSpecifytheOpenAIGPTmodel-kAPI_KEY,--keyAPI_KEYSetyourOpenAIAPIkey--set-modelMODEL_NAMESetthedefaultOpenAIGPTmodel--no-copyDonotcopythecommitmessagetotheclipboard--no-loadDonotshowloadingmessage-tTICKET,--ticketTICKETRequestthattheprovidedGitHubissuebelinkedinthecommitmessage-sSTART,--startSTARTProvidethestartofthecommitmessage--llamaLLAMAPassalocalhostLlama2serverasareplacementforOpenAIAPIFor models, note that:You need to specify anOpenAI GPT model.e.g.gpt-3.5-turbo-0301, orgpt-4There is an experimental mode which uses Meta's Llama2 models instead.(seeExperiments > Llama2 Modelbelow)Your OpenAI account needs to have access to the model you specify.i.e. Don't specifygpt-4if you don't have access to it.ExperimentsVSCode ExtensionCurrently in "alpha" status (v 0.0.3). It works, completely, but we need to address the following:Write automated testsFix anyknown bugsWrite documentationOfficially publish to the VSCode MarketplaceLlama2 ModelLlama2 is a free alternative to OpenAI'sGPT-3.5, created by Meta (Facebook). A long-term goal ofmagic-commitis to support Llama2 fully, allowing you to use it without needing to pay OpenAI or send any potentially sensitive data to them.To that end, you can pass a runninglocalhostLlama2 server tomagic-commitlike so:magic-commit--llamahttp://localhost:8080# or whatever port you're usingNote that you'll need to have a running Llama2 server. If you're on MacOS, I foundthese instructionsfrom thellama-cpp-pythonproject fairly easy to follow.In the future, the end goal is to seamlessly support both OpenAI and Llama2 models, and to allow you to switch between them with a simple flag.LoRA Fine-Tuned ModelLlama2 models capable of running on a normal computer have to be fairly small, e.g. 7 billion parameters. This is a lot, but it's a far cry from the 175 billion parameters of OpenAI'sGPT-3.5model. Performance for this task out-of-the-box is not great.However, there is hope. Low-Rank Adaptation (LoRA) is a technique for specializing a large model to a smaller one. To quote theresearch paper:Compared to GPT-3 175B fine-tuned with Adam, LoRA can reduce the number of trainable parameters by 10,000 times and the GPU memory requirement by 3 times. LoRA performs on-par or better than fine-tuning in model quality on RoBERTa, DeBERTa, GPT-2, and GPT-3I do believe that we can potentially get GPT-3.5 level of quality while running on a laptop. You can see my experiments with this in thelora-experimentsfolder. If you have any ideas or suggestions, please reach out!Developer NotesPlease feel free to open a GitHub issue, submit a pull request, or to reach out if you have any questions or suggestions!Building the Command-Line ToolNote: This is referring to a local development build. For production, seePublishing to PyPIbelow.cdcli/magic_commit
pipinstall-e.# install the package in editable modeBuilding the VSCode Extensioncdvscode/magic-commit
npminstallvsce# if you don't have it alreadyvscepackage# creates a .vsix filePublishing to PyPITo publish a new version to PyPI:cdcli/magic_commit
pipinstalltwinewheel
pythonsetup.pysdistbdist_wheel# build the packagetwineuploaddist/*# upload to PyPIUnit TestsTo run the unit tests:cdcli/magic_commit/tests
pytest