Skip to content

Commit

Permalink
ref: enable deepseek
Browse files Browse the repository at this point in the history
  • Loading branch information
ex3ndr committed Nov 26, 2023
1 parent 22b28e8 commit ee6adae
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 16 deletions.
19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "llama-coder",
"displayName": "Llama Coder",
"description": "Better and self-hosted Github Copilot replacement",
"version": "0.0.6",
"version": "0.0.7",
"icon": "icon.png",
"publisher": "ex3ndr",
"repository": {
Expand Down Expand Up @@ -70,14 +70,15 @@
"codellama:34b-code-q4_K_S",
"codellama:34b-code-q4_K_M",
"codellama:34b-code-q6_K",
"deepseek-coder:6.7b-instruct-q4_K_S",
"deepseek-coder:6.7b-instruct-q4_K_M",
"deepseek-coder:6.7b-instruct-q8_0",
"deepseek-coder:6.7b-instruct-fp16",
"deepseek-coder:33b-instruct-q4_K_S",
"deepseek-coder:33b-instruct-q4_K_M",
"deepseek-coder:33b-instruct-q8_0",
"deepseek-coder:33b-instruct-fp16"
"deepseek-coder:1.3b-base-q4_0",
"deepseek-coder:1.3b-base-q4_1",
"deepseek-coder:1.3b-base-q8_0",
"deepseek-coder:6.7b-base-q4_K_S",
"deepseek-coder:6.7b-base-q8_0",
"deepseek-coder:6.7b-base-fp16",
"deepseek-coder:33b-base-q4_K_S",
"deepseek-coder:33b-base-q4_K_M",
"deepseek-coder:33b-base-fp16"
],
"default": "codellama:7b-code-q4_K_M",
"description": "Inference model to use"
Expand Down
20 changes: 17 additions & 3 deletions src/prompts/adaptors/adaptPrompt.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
export function adaptPrompt(args: { model: string, prefix: string, suffix: string }): string {
export function adaptPrompt(args: { model: string, prefix: string, suffix: string }): { prompt: string, stop: string[] } {

// Starcoder format
if (args.model.startsWith('deepseek-coder')) {
return `<|fim▁begin|>${args.prefix}<|fim▁hole|>${args.suffix}<|fim▁end|>`;

if (args.suffix.length < 1000) {
return {
prompt: args.prefix,
stop: [`<END>`]
};
}

return {
prompt: `<|fim▁begin|>${args.prefix}<|fim▁hole|>${args.suffix}<|fim▁end|>`,
stop: [`<|fim▁begin|>`, `<|fim▁hole|>`, `<|fim▁end|>`, `<END>`]
};
}

// Codellama format
return `<PRE> ${args.prefix} <SUF>${args.suffix} <MID>`;
return {
prompt: `<PRE> ${args.prefix} <SUF>${args.suffix} <MID>`,
stop: [`<PRE>`, `<SUF>`, `<MID>`, `<END>`]
};
}
5 changes: 4 additions & 1 deletion src/prompts/autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ export async function autocomplete(args: {
canceled?: () => boolean,
}): Promise<string> {

let prompt = adaptPrompt({ prefix: args.prefix, suffix: args.suffix, model: args.model });

// Calculate arguments
let data = {
model: args.model,
prompt: adaptPrompt({ prefix: args.prefix, suffix: args.suffix, model: args.model }),
prompt: prompt.prompt,
raw: true,
options: {
stop: prompt.stop,
num_predict: args.maxTokens,
temperature: args.temperature
}
Expand Down
6 changes: 3 additions & 3 deletions src/prompts/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ export function isNotNeeded(doc: vscode.TextDocument, position: vscode.Position,
// }

// Avoid autocomplete when system menu is shown (ghost text is hidden anyway)
if (context.selectedCompletionInfo) {
return true;
}
// if (context.selectedCompletionInfo) {
// return true;
// }

return false;
}
10 changes: 10 additions & 0 deletions src/prompts/processors/detectLanguage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// import path from 'path';

// let languages: { [key: string]: {} } = {

// };

// export function fileHeaderProcessor(uri: string, languageId: string): string | null {
// let basename = path.basename(uri);
// let extname =
// }

0 comments on commit ee6adae

Please sign in to comment.