Skip to content

feat(completion): move to codegemmy completion #32

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

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,11 @@
"markdownDescription": "Select a model for the automatic mode based on your system specifications.",
"enum": [
"base-small",
"base-medium",
"base-large"
"base-medium"
],
"enumDescriptions": [
"Use if you have only CPU.",
"Use if you have standard GPU.",
"Use if you have enterprise GPU."
"Use if you have standard GPU."
]
},
"firecoder.completion.manuallyMode": {
Expand All @@ -128,13 +126,11 @@
"markdownDescription": "Select a model for the manually mode based on your system specifications.",
"enum": [
"base-small",
"base-medium",
"base-large"
"base-medium"
],
"enumDescriptions": [
"Use if you have only CPU.",
"Use if you have standard GPU.",
"Use if you have enterprise GPU."
"Use if you have standard GPU."
]
},
"firecoder.experimental.useopentabs": {
Expand Down
4 changes: 2 additions & 2 deletions src/common/completion/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ export const getInlineCompletionProvider = (
const parameters = triggerAuto
? {
n_predict: 128,
stop: ["\n"],
stop: ["\n", "<|file_separator|>"],
}
: {
n_predict: 512,
stop: [],
stop: ["<|file_separator|>"],
temperature: 0.5,
};

Expand Down
15 changes: 5 additions & 10 deletions src/common/download/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,19 +155,14 @@ const getModelInfo = async (
): Promise<ResourceInfo | null> => {
const models: Record<TypeModel, { url: string; checksum: string }> = {
"base-small": {
url: "https://huggingface.co/TheBloke/deepseek-coder-1.3b-base-GGUF/resolve/main/deepseek-coder-1.3b-base.Q8_0.gguf",
url: "https://huggingface.co/lmstudio-community/codegemma-2b-GGUF/resolve/main/codegemma-2b-Q5_K_M.gguf",
checksum:
"9fcdcb283ef5b1d80ec7365b307c1ceab0c0f8ea079b49969f7febc06a11bccd",
"95f06d59cbf697da2fe9aa00b019c4f2e464718a956352ccbbb1cb436b98a2a7",
},
"base-medium": {
url: "https://huggingface.co/TheBloke/deepseek-coder-6.7B-base-GGUF/resolve/main/deepseek-coder-6.7b-base.Q8_0.gguf",
url: "https://huggingface.co/lmstudio-community/codegemma-7b-GGUF/resolve/main/codegemma-7b-Q5_K_M.gguf",
checksum:
"a2f82242ac5e465037cbf1ed754f04f0be044ee196e1589905f9e4dcd0e6559d",
},
"base-large": {
url: "https://huggingface.co/TheBloke/deepseek-coder-33B-base-GGUF/resolve/main/deepseek-coder-33b-base.Q8_0.gguf",
checksum:
"9b9210b7de8c26d94773146613ee86844a714aae997223355bb520927627feff",
"eb00372705e7d5d30442750e8a7c72919c8e243bee52e1cce97fcfc1008c6143",
},
"chat-small": {
url: "https://huggingface.co/TheBloke/deepseek-coder-1.3b-instruct-GGUF/resolve/main/deepseek-coder-1.3b-instruct.Q8_0.gguf",
Expand Down Expand Up @@ -263,7 +258,7 @@ export const downloadModel = async (typeModel: TypeModel) => {
const modelFileInfo = await getModelInfo(typeModel);

if (modelFileInfo === null) {
throw new Error("Server file info not found");
throw new Error("Model file info not found");
}

Logger.info(`Got model ${typeModel} file info`, {
Expand Down
18 changes: 14 additions & 4 deletions src/common/prompt/promptCompletion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const processingDocumentWithPosition = async ({
tokenDifference <= maxDifference
) {
return {
documentText: `${textBeforeSlice}<|fim▁hole|>${textAfterSlice}`,
documentText: `${textBeforeSlice}<|fim_suffix|>${textAfterSlice}`,
documentTokens: tokens,
};
}
Expand Down Expand Up @@ -244,17 +244,27 @@ export const getPromptCompletion = async ({
);

additionalDocumentsText +=
"\n" + getRelativePath(document.uri) + "\n" + documentText;
"/" +
getRelativePath(document.uri) +
"\n" +
"<|fim_prefix|>" +
documentText +
"<|fim_middle|>" +
"<|file_separator|>";
restTokens -= documentTokens;
}
}

const activeDocumentFileName =
additionalDocumentsText === ""
? ""
: "\n" + getRelativePath(activeDocument.uri) + "\n";
: "\n" +
"/" +
getRelativePath(activeDocument.uri) +
"\n" +
"<|fim_prefix|>";

const prompt = `<|fim▁begin|>${additionalDocumentsText}${activeDocumentFileName}${activeDocumentText}<|fim▁end|>`;
const prompt = `${additionalDocumentsText}${activeDocumentFileName}${activeDocumentText}<|fim_middle|>`;

return prompt;
};
4 changes: 0 additions & 4 deletions src/common/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ const modelsBase = {
"base-medium": {
port: 39721,
},
"base-large": {
port: 39722,
},
};
export type TypeModelsBase = keyof typeof modelsBase;

Expand Down Expand Up @@ -310,7 +307,6 @@ class Server {
export const servers = {
"base-small": new Server("base-small"),
"base-medium": new Server("base-medium"),
"base-large": new Server("base-large"),
"chat-small": new Server("chat-small"),
"chat-medium": new Server("chat-medium"),
"chat-large": new Server("chat-large"),
Expand Down