From be15bef5cd5aa16806b1043b229a49f07b00284b Mon Sep 17 00:00:00 2001 From: kumarijy Date: Wed, 24 Jan 2024 22:28:33 -0800 Subject: [PATCH 1/8] Adding FIM support through deepseek-coder-1.3b-instruct and changed model names at FE --- modules/openvino_code/package.json | 41 +++++++++++++++++-- modules/openvino_code/shared/features.ts | 1 + modules/openvino_code/shared/model.ts | 9 +++- .../ServerSection/ModelSelect/ModelSelect.tsx | 1 + 4 files changed, 47 insertions(+), 5 deletions(-) diff --git a/modules/openvino_code/package.json b/modules/openvino_code/package.json index ee16aa4b0..aad0f1121 100644 --- a/modules/openvino_code/package.json +++ b/modules/openvino_code/package.json @@ -190,11 +190,12 @@ "openvinoCode.model": { "order": 0, "type": "string", - "default": "codet5p-220m-py", + "default": "code-t5", "enum": [ - "codet5p-220m-py", + "code-t5", "decicoder-1b-openvino-int8", - "stablecode-completion-3b-int8" + "stablecode-completion", + "deepseek-coder" ], "description": "Which model to use for code generation." }, @@ -229,6 +230,40 @@ "default": "false", "description": "When checked inline complention will be generated in streaming mode" }, + "openvinoCode.fillInTheMiddleMode": { + "order": 4, + "type": "boolean", + "default": "false", + "description": + "When checked, text before (above) and after (below) the cursor will be used for completion generation. When unckecked, only text before (above) the cursor will be used." + }, + "openvinoCode.startToken": { + "order": 7, + "type": "string", + "default": "", + "description": + "String that is sent to server is in format: `{startToken}{text above cursor}{middleToken}{text below cursor if fillInTheMiddleMode=true}{endToken}`. Leave `startToken`, `middleToken`, or `endToken` empty if there is no special token for those placements." + }, + "openvinoCode.middleToken": { + "order": 8, + "type": "string", + "default": "", + "description": + "String that is sent to server is in format: `{startToken}{text above cursor}{middleToken}{text below cursor if fillInTheMiddleMode=true}{endToken}`. Leave `startToken`, `middleToken`, or `endToken` empty if there is no special token for those placements." + }, + "openvinoCode.endToken": { + "order": 9, + "type": "string", + "default": "", + "description": + "String that is sent to server is in format: `{startToken}{text above cursor}{middleToken}{text below cursor if fillInTheMiddleMode=true}{endToken}`. Leave `startToken`, `middleToken`, or `endToken` empty if there is no special token for those placements." + }, + "openvinoCode.stopToken": { + "order": 10, + "type": "string", + "default": "<|endoftext|>", + "description": "(Optional) Stop token." + }, "openvinoCode.temperature": { "order": 4, "type": "number", diff --git a/modules/openvino_code/shared/features.ts b/modules/openvino_code/shared/features.ts index d376256b2..48a406c77 100644 --- a/modules/openvino_code/shared/features.ts +++ b/modules/openvino_code/shared/features.ts @@ -1,4 +1,5 @@ export enum Features { CODE_COMPLETION = 'Code Completion', SUMMARIZATION = 'Summarization', + FIM = 'Fill-in-the-middle', } diff --git a/modules/openvino_code/shared/model.ts b/modules/openvino_code/shared/model.ts index 8d642c39a..172fea620 100644 --- a/modules/openvino_code/shared/model.ts +++ b/modules/openvino_code/shared/model.ts @@ -4,22 +4,27 @@ enum ModelId { CODE_T5_220M = 'Salesforce/codet5p-220m-py', DECICODER_1B_OPENVINO_INT8 = 'chgk13/decicoder-1b-openvino-int8', STABLECODE_COMPLETION_ALPHA_3B_4K_OPENVINO_INT8 = 'chgk13/stablecode-completion-alpha-3b-4k-openvino-int8', + //deepseek_coder = 'deepseek-ai/deepseek-coder-6.7b-instruct', + deepseek_coder_7b = 'kumarijy/deepseek-coder-1.3b-instruct_ov', } export enum ModelName { - CODE_T5_220M = 'codet5p-220m-py', + CODE_T5_220M = 'code-t5', DECICODER_1B_OPENVINO_INT8 = 'decicoder-1b-openvino-int8', - STABLECODE_COMPLETION_ALPHA_3B_4K_OPENVINO_INT8 = 'stablecode-completion-3b-int8', + STABLECODE_COMPLETION_ALPHA_3B_4K_OPENVINO_INT8 = 'stablecode-completion', + deepseek_coder_7b = 'deepseek-coder', } export const MODEL_NAME_TO_ID_MAP: Record = { [ModelName.CODE_T5_220M]: ModelId.CODE_T5_220M, [ModelName.DECICODER_1B_OPENVINO_INT8]: ModelId.DECICODER_1B_OPENVINO_INT8, [ModelName.STABLECODE_COMPLETION_ALPHA_3B_4K_OPENVINO_INT8]: ModelId.STABLECODE_COMPLETION_ALPHA_3B_4K_OPENVINO_INT8, + [ModelName.deepseek_coder_7b]: ModelId.deepseek_coder_7b, }; export const MODEL_SUPPORTED_FEATURES: Record = { [ModelName.CODE_T5_220M]: [Features.CODE_COMPLETION], [ModelName.DECICODER_1B_OPENVINO_INT8]: [Features.CODE_COMPLETION, Features.SUMMARIZATION], [ModelName.STABLECODE_COMPLETION_ALPHA_3B_4K_OPENVINO_INT8]: [Features.CODE_COMPLETION, Features.SUMMARIZATION], + [ModelName.deepseek_coder_7b]: [Features.CODE_COMPLETION, Features.SUMMARIZATION, Features.FIM], }; diff --git a/modules/openvino_code/side-panel-ui/src/components/sections/ServerSection/ModelSelect/ModelSelect.tsx b/modules/openvino_code/side-panel-ui/src/components/sections/ServerSection/ModelSelect/ModelSelect.tsx index 16746a7c7..f65bb5175 100644 --- a/modules/openvino_code/side-panel-ui/src/components/sections/ServerSection/ModelSelect/ModelSelect.tsx +++ b/modules/openvino_code/side-panel-ui/src/components/sections/ServerSection/ModelSelect/ModelSelect.tsx @@ -7,6 +7,7 @@ const options: SelectOptionProps[] = [ { value: ModelName.CODE_T5_220M }, { value: ModelName.DECICODER_1B_OPENVINO_INT8 }, { value: ModelName.STABLECODE_COMPLETION_ALPHA_3B_4K_OPENVINO_INT8 }, + { value: ModelName.deepseek_coder_7b }, ]; interface ModelSelectProps { From e77b4cb7f224008abe25b895ea0026ac3197070c Mon Sep 17 00:00:00 2001 From: kumarijy Date: Sun, 4 Feb 2024 12:07:47 -0800 Subject: [PATCH 2/8] used ALL_CAPS for model name consistency and replaced 7B with 1_3B --- modules/openvino_code/shared/model.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/modules/openvino_code/shared/model.ts b/modules/openvino_code/shared/model.ts index 172fea620..cd8fa400d 100644 --- a/modules/openvino_code/shared/model.ts +++ b/modules/openvino_code/shared/model.ts @@ -4,27 +4,26 @@ enum ModelId { CODE_T5_220M = 'Salesforce/codet5p-220m-py', DECICODER_1B_OPENVINO_INT8 = 'chgk13/decicoder-1b-openvino-int8', STABLECODE_COMPLETION_ALPHA_3B_4K_OPENVINO_INT8 = 'chgk13/stablecode-completion-alpha-3b-4k-openvino-int8', - //deepseek_coder = 'deepseek-ai/deepseek-coder-6.7b-instruct', - deepseek_coder_7b = 'kumarijy/deepseek-coder-1.3b-instruct_ov', + DEEPSEEK_CODER_1_3B = 'kumarijy/deepseek-coder-1.3b-instruct_ov', } export enum ModelName { CODE_T5_220M = 'code-t5', DECICODER_1B_OPENVINO_INT8 = 'decicoder-1b-openvino-int8', STABLECODE_COMPLETION_ALPHA_3B_4K_OPENVINO_INT8 = 'stablecode-completion', - deepseek_coder_7b = 'deepseek-coder', + DEEPSEEK_CODER_1_3B = 'deepseek-coder', } export const MODEL_NAME_TO_ID_MAP: Record = { [ModelName.CODE_T5_220M]: ModelId.CODE_T5_220M, [ModelName.DECICODER_1B_OPENVINO_INT8]: ModelId.DECICODER_1B_OPENVINO_INT8, [ModelName.STABLECODE_COMPLETION_ALPHA_3B_4K_OPENVINO_INT8]: ModelId.STABLECODE_COMPLETION_ALPHA_3B_4K_OPENVINO_INT8, - [ModelName.deepseek_coder_7b]: ModelId.deepseek_coder_7b, + [ModelName.DEEPSEEK_CODER_1_3B]: ModelId.DEEPSEEK_CODER_1_3B, }; export const MODEL_SUPPORTED_FEATURES: Record = { [ModelName.CODE_T5_220M]: [Features.CODE_COMPLETION], [ModelName.DECICODER_1B_OPENVINO_INT8]: [Features.CODE_COMPLETION, Features.SUMMARIZATION], [ModelName.STABLECODE_COMPLETION_ALPHA_3B_4K_OPENVINO_INT8]: [Features.CODE_COMPLETION, Features.SUMMARIZATION], - [ModelName.deepseek_coder_7b]: [Features.CODE_COMPLETION, Features.SUMMARIZATION, Features.FIM], + [ModelName.DEEPSEEK_CODER_1_3B]: [Features.CODE_COMPLETION, Features.SUMMARIZATION, Features.FIM], }; From 2625d7fe1c47b51021f7cc5a11089543e84e99cd Mon Sep 17 00:00:00 2001 From: kumarijy Date: Sun, 4 Feb 2024 12:25:08 -0800 Subject: [PATCH 3/8] fixed frontend modelname --- .../sections/ServerSection/ModelSelect/ModelSelect.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/openvino_code/side-panel-ui/src/components/sections/ServerSection/ModelSelect/ModelSelect.tsx b/modules/openvino_code/side-panel-ui/src/components/sections/ServerSection/ModelSelect/ModelSelect.tsx index f65bb5175..110a90cc0 100644 --- a/modules/openvino_code/side-panel-ui/src/components/sections/ServerSection/ModelSelect/ModelSelect.tsx +++ b/modules/openvino_code/side-panel-ui/src/components/sections/ServerSection/ModelSelect/ModelSelect.tsx @@ -7,7 +7,7 @@ const options: SelectOptionProps[] = [ { value: ModelName.CODE_T5_220M }, { value: ModelName.DECICODER_1B_OPENVINO_INT8 }, { value: ModelName.STABLECODE_COMPLETION_ALPHA_3B_4K_OPENVINO_INT8 }, - { value: ModelName.deepseek_coder_7b }, + { value: ModelName.DEEPSEEK_CODER_1_3B }, ]; interface ModelSelectProps { From 1048ec4f993d68d0ec768fc3bd8924c3cd8e069f Mon Sep 17 00:00:00 2001 From: kumarijy Date: Sun, 4 Feb 2024 12:27:45 -0800 Subject: [PATCH 4/8] changed version to 0.0.8 --- modules/openvino_code/package-lock.json | 4 ++-- modules/openvino_code/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/openvino_code/package-lock.json b/modules/openvino_code/package-lock.json index 89fa7c2e1..0b2521f49 100644 --- a/modules/openvino_code/package-lock.json +++ b/modules/openvino_code/package-lock.json @@ -1,12 +1,12 @@ { "name": "openvino-code-completion", - "version": "0.0.6", + "version": "0.0.8", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "openvino-code-completion", - "version": "0.0.6", + "version": "0.0.8", "license": "https://github.com/openvinotoolkit/openvino_contrib/blob/master/LICENSE", "workspaces": [ "side-panel-ui" diff --git a/modules/openvino_code/package.json b/modules/openvino_code/package.json index aad0f1121..68f08ca36 100644 --- a/modules/openvino_code/package.json +++ b/modules/openvino_code/package.json @@ -1,7 +1,7 @@ { "publisher": "OpenVINO", "name": "openvino-code-completion", - "version": "0.0.6", + "version": "0.0.8", "displayName": "OpenVINO Code Completion", "description": "VSCode extension for AI code completion with OpenVINO", "icon": "media/logo.png", From 52d861045106561587c1ed88246e9217c5113e36 Mon Sep 17 00:00:00 2001 From: kumarijy Date: Sun, 4 Feb 2024 13:30:06 -0800 Subject: [PATCH 5/8] changed FIM tokens format in alignment with HF model deepseek-coder format --- modules/openvino_code/package.json | 6 +++--- .../sections/ServerSection/ModelSelect/ModelSelect.tsx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/openvino_code/package.json b/modules/openvino_code/package.json index 68f08ca36..a20e3b8a4 100644 --- a/modules/openvino_code/package.json +++ b/modules/openvino_code/package.json @@ -240,21 +240,21 @@ "openvinoCode.startToken": { "order": 7, "type": "string", - "default": "", + "default": "< |fim_begin| >", "description": "String that is sent to server is in format: `{startToken}{text above cursor}{middleToken}{text below cursor if fillInTheMiddleMode=true}{endToken}`. Leave `startToken`, `middleToken`, or `endToken` empty if there is no special token for those placements." }, "openvinoCode.middleToken": { "order": 8, "type": "string", - "default": "", + "default": "<|fim▁hole|>", "description": "String that is sent to server is in format: `{startToken}{text above cursor}{middleToken}{text below cursor if fillInTheMiddleMode=true}{endToken}`. Leave `startToken`, `middleToken`, or `endToken` empty if there is no special token for those placements." }, "openvinoCode.endToken": { "order": 9, "type": "string", - "default": "", + "default": "<|fim▁end|>", "description": "String that is sent to server is in format: `{startToken}{text above cursor}{middleToken}{text below cursor if fillInTheMiddleMode=true}{endToken}`. Leave `startToken`, `middleToken`, or `endToken` empty if there is no special token for those placements." }, diff --git a/modules/openvino_code/side-panel-ui/src/components/sections/ServerSection/ModelSelect/ModelSelect.tsx b/modules/openvino_code/side-panel-ui/src/components/sections/ServerSection/ModelSelect/ModelSelect.tsx index 110a90cc0..06a1bc9ff 100644 --- a/modules/openvino_code/side-panel-ui/src/components/sections/ServerSection/ModelSelect/ModelSelect.tsx +++ b/modules/openvino_code/side-panel-ui/src/components/sections/ServerSection/ModelSelect/ModelSelect.tsx @@ -35,7 +35,7 @@ export const ModelSelect = ({ disabled={disabled} onChange={(value) => onChange(value)} > - {isServerStopped && Supported Featues: {supportedFeatures.join(', ')}} + {isServerStopped && Supported Features: {supportedFeatures.join(', ')}} ); }; From a841d512aac9c7664e87717dad6e01662e9b6a7f Mon Sep 17 00:00:00 2001 From: kumarijy Date: Sun, 4 Feb 2024 15:05:23 -0800 Subject: [PATCH 6/8] added README for adding Fill in the middle mode support and updated OverviewSection --- modules/openvino_code/README.md | 18 ++++++++++++++++++ .../OverviewSection/OverviewSection.tsx | 3 ++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/modules/openvino_code/README.md b/modules/openvino_code/README.md index cd5f5dc57..448dbcc35 100644 --- a/modules/openvino_code/README.md +++ b/modules/openvino_code/README.md @@ -8,6 +8,7 @@ OpenVINO Code provides the following features: - Inline Code Completion - Summarization via Docstring +- Fill in the Middle Mode ## Working with Extension @@ -48,6 +49,23 @@ You can select the desired type of quotes in the extension settings. The model can generate docstring in Code Completion mode, but in this case it is impossible to control the result. In the docstring generation mode, various popular templates are available in the settings that will guide the model output. +### Fill in the Middle Mode + + +1. Create a new Python file or open an existing one. +1. Type `def main():` or place the cursor where you'd like middle text to be generated. +1. Press the keyboard shortcut `Ctrl+Alt+Space` (`Cmd+Alt+Space` for macOS) or click the `Generate Code Completion` button located in the side panel. +1. You can select the text then generate the related code. +1. You may also right-click on "Generate Inline Code Completion In New Tab" to generate code in a new tab. +1. Use the `Tab` key to accept the entire suggestion or `Ctrl`+`Right Arrow` to accept it word by word. To decline the suggestion, press `Esc`. + +You can customize the length of the generated code by adjusting `Max New Tokens` and `Min New Tokens` parameters in the extension settings. +The number of generated tokens is also influenced by the `Server Request Timeout` setting. + +Fill in the middle mode brings in advanced code completion capabilities supporting fill-in-the-blank task, supporting project-level code completion and infilling tasks. + +To enable fill in the middle mode, check the `Fill In The Middle Mode` checkbox in the extension settings. + ### Monitoring Extension Output To examine the input and output from the code generation API, follow these steps: diff --git a/modules/openvino_code/side-panel-ui/src/components/sections/OverviewSection/OverviewSection.tsx b/modules/openvino_code/side-panel-ui/src/components/sections/OverviewSection/OverviewSection.tsx index cf699f713..a785538eb 100644 --- a/modules/openvino_code/side-panel-ui/src/components/sections/OverviewSection/OverviewSection.tsx +++ b/modules/openvino_code/side-panel-ui/src/components/sections/OverviewSection/OverviewSection.tsx @@ -7,7 +7,8 @@ export function OverviewSection(): JSX.Element { OpenVINO Code provides the following features:
  • Inline Code Completion
  • -
  • Summarization via docstring
  • +
  • Summarization via docstring
  • +
  • Fill in the Middle Mode
To use OpenVINO Code please start the server. From 072853dea02022af40ef85223a5b65301f63f19b Mon Sep 17 00:00:00 2001 From: kumarijy Date: Mon, 5 Feb 2024 19:47:22 -0800 Subject: [PATCH 7/8] removed int8 from decicoder-1b-openvino model name --- modules/openvino_code/package.json | 2 +- modules/openvino_code/shared/model.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/openvino_code/package.json b/modules/openvino_code/package.json index a20e3b8a4..d3dd85362 100644 --- a/modules/openvino_code/package.json +++ b/modules/openvino_code/package.json @@ -193,7 +193,7 @@ "default": "code-t5", "enum": [ "code-t5", - "decicoder-1b-openvino-int8", + "decicoder-1b-openvino", "stablecode-completion", "deepseek-coder" ], diff --git a/modules/openvino_code/shared/model.ts b/modules/openvino_code/shared/model.ts index cd8fa400d..a6090975f 100644 --- a/modules/openvino_code/shared/model.ts +++ b/modules/openvino_code/shared/model.ts @@ -9,7 +9,7 @@ enum ModelId { export enum ModelName { CODE_T5_220M = 'code-t5', - DECICODER_1B_OPENVINO_INT8 = 'decicoder-1b-openvino-int8', + DECICODER_1B_OPENVINO_INT8 = 'decicoder-1b-openvino', STABLECODE_COMPLETION_ALPHA_3B_4K_OPENVINO_INT8 = 'stablecode-completion', DEEPSEEK_CODER_1_3B = 'deepseek-coder', } From deedad452bedd765d0ee063082484d1e29fdde78 Mon Sep 17 00:00:00 2001 From: kumarijy Date: Mon, 5 Feb 2024 23:12:50 -0800 Subject: [PATCH 8/8] added deepseek-coder int-8 model --- modules/openvino_code/shared/model.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/openvino_code/shared/model.ts b/modules/openvino_code/shared/model.ts index a6090975f..e08930ecc 100644 --- a/modules/openvino_code/shared/model.ts +++ b/modules/openvino_code/shared/model.ts @@ -4,7 +4,7 @@ enum ModelId { CODE_T5_220M = 'Salesforce/codet5p-220m-py', DECICODER_1B_OPENVINO_INT8 = 'chgk13/decicoder-1b-openvino-int8', STABLECODE_COMPLETION_ALPHA_3B_4K_OPENVINO_INT8 = 'chgk13/stablecode-completion-alpha-3b-4k-openvino-int8', - DEEPSEEK_CODER_1_3B = 'kumarijy/deepseek-coder-1.3b-instruct_ov', + DEEPSEEK_CODER_1_3B = 'kumarijy/deepseek-coder-1_3b-instruct-openvino-int8', } export enum ModelName {