WIP: this is a PoC at the moment
This Neovim client is like Copilot but you can pick your model on the Hugging Face Hub.
Heavily inspired by copilot.lua and tabnine-nvim
-
Create and get your API token from here https://huggingface.co/settings/tokens.
-
Define how the plugin will read your token. For this you have multiple options, in order of precedence:
- Pass
api_token = <your token>
in plugin opts - this is not recommended if you use a versioning tool for your configuration files - Set the
HUGGING_FACE_HUB_TOKEN
environment variable - You can define your
HF_HOME
environment variable and create a file containing your token at$HF_HOME/token
- Install the huggingface-cli and run
huggingface-cli login
- this will prompt you to enter your token and set it at the right path
- Pass
-
Choose your model on the Hugging Face Hub
Using packer
require("packer").startup(function(use)
use {
'huggingface/hfcc.nvim',
config = function()
require('hfcc').setup({
-- cf Setup
})
end
}
end)
Using lazy.nvim
require("lazy").setup({
{
'huggingface/hfcc.nvim',
opts = {
-- cf Setup
}
},
})
Using vim-plug
Plug 'huggingface/hfcc.nvim'
require('hfcc').setup({
model = "bigcode/starcoder" -- can be a model ID or an http endpoint
})
local hfcc = require('hfcc')
hfcc.setup({
api_token = "", -- cf Install paragraph
model = "bigcode/starcoder" -- can be a model ID or an http(s) endpoint
-- parameters that are added to the request body
query_params = {
max_new_tokens = 60,
temperature = 0.2,
top_p = 0.95,
stop_token = "<|endoftext|>",
},
-- set this if the model supports fill in the middle
fim = {
enabled = true,
prefix = "<fim_prefix>",
middle = "<fim_middle>",
suffix = "<fim_suffix>",
},
})