New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Elixir code completion #2332
Open
jonastemplestein
wants to merge
8
commits into
livebook-dev:main
Choose a base branch
from
jonastemplestein:copilot_completion
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[WIP] Elixir code completion #2332
jonastemplestein
wants to merge
8
commits into
livebook-dev:main
from
jonastemplestein:copilot_completion
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set OPENAI_API_KEY env var to play around with it
Ah sorry, I meant to open this under my own fork. Shall I move it there? |
Feel free to leave it here for people to play with :) |
jonastemplestein
changed the title
MVP copilot completion using GPT4 API
[WIP] Elixir code completion
Nov 10, 2023
This means you can now use any model for completion that llama.cpp can run Just compile llama.cpp and run the server like this: ./server -m codellama-7b.Q5_K_M.gguf -c 4096 I've tested this with codellama 7B quantised (codellama-7b.Q5_K_M.gguf) and it works well. But I have no idea if the special `/infill` endpoint works for other models, as I don't know how llama.cpp would know about the infilling tokens
- Refactored the way copilot completion backends work - Added Livebook.Copilot.BumblebeeBackend (including attempting to run Serving under new DynamicSupervisor) - Added Livebook.Copilot.DummyBackend for testing - Added Livebook.Copilot.LlamaCppHttpBackend for running models in llama.cpp's server locally - Added Livebook.Copilot.OpenaiBackend for running on OpenAi - Added Livebook.Copilot.HuggingfaceBackend to use HF inference endpoints - Played around with adding some user feedback via flash messages - Fixed a whole bunch of edge cases and bugs in client side logic - Request completions instantly (instead of debounced) when manually requested - Added special comments you can put in livebook cells that will override the configured copilot backend
Reverting to GPT2
Just to give a little update on this:
Will hopefully have a model that is demonstrably better than bumblebee-1.3b by the end of the week |
Bumblebee or deepseekr? :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The aim of this PR is to eventually offer Elixir inline code completion within Livebook.
The high level design is like this
For more context on the project, see this this random document with (slightly outdated) notes.
Status
This is a very minimal implementation of copilot style code completion.
At the moment the only LLM supported is the GPT4 API. Set OPENAI_API_KEY env var to play around with it.
Inline completion should appear 500ms after you stop typing. Or use Ctrl + Space to force inline completion to appear.
TODO in Livebook
Frontend polish
Livebook plumbing
Model inference
Tests!
TODO for fine-tuning a model
The hardest task is to actually fine-tune a model
One of the most fiddly bits seems to be to properly tokenise the special infilling tokens (both in bumblebee and llama.cpp). This seems a bit fiddly and the models often output garbage if you get this wrong. There is some good context on these llama.cpp threads [1] [2]