Skip to content
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

Update models to granite3.1-* #177

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
4 changes: 1 addition & 3 deletions src/commons/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
export const EXTENSION_ID = 'redhat.vscode-paver';
export const isDevMode = process.env.PAVER_EXT_DEV_MODE === 'true';
export const DOWNLOADABLE_MODELS = ['nomic-embed-text:latest', 'granite-code:3b', 'granite-code:8b', 'granite3-dense:2b', 'granite3-dense:8b'];

export const isDevMode = process.env.PAVER_EXT_DEV_MODE === 'true';
6 changes: 3 additions & 3 deletions src/commons/modelInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ export const DEFAULT_MODEL_INFO = new Map<string, ModelInfo>();
digest: ''
},
{
id: 'granite3-dense:2b',
size: '1.6GB',
id: 'granite3.1-dense:2b',
size: '1.5GB',
digest: ''
},
{
id: 'granite3-dense:8b',
id: 'granite3.1-dense:8b',
size: '4.9GB',
digest: ''
},
Expand Down
8 changes: 5 additions & 3 deletions src/commons/modelRequirements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ export interface ModelRequirements {
}

export const MODEL_REQUIREMENTS: Record<string, ModelRequirements> = {
"granite3-dense:2b": {
"granite3.1-dense:2b": {
minMemoryBytes: 4 * GB,
recommendedMemoryBytes: 8 * GB,
gpuRecommended: false,
sizeBytes: Math.ceil(1.6 * GB)
sizeBytes: Math.ceil(1.5 * GB)
},
"granite3-dense:8b": {
"granite3.1-dense:8b": {
minMemoryBytes: 12 * GB,
recommendedMemoryBytes: 16 * GB,
gpuRecommended: true,
Expand All @@ -42,6 +42,8 @@ export const MODEL_REQUIREMENTS: Record<string, ModelRequirements> = {
}
};

export const DOWNLOADABLE_MODELS = Object.keys(MODEL_REQUIREMENTS);

interface ValidationResult {
isCompatible: boolean;
warnings: string[];
Expand Down
4 changes: 2 additions & 2 deletions src/commons/sysInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ export function hasDiscreteGPU(gpus: GpuInfo[]): boolean {

export function getRecommendedModels(systemInfo: SystemInfo) {
const defaultGraniteModel = isHighEndMachine(systemInfo)
? "granite3-dense:8b" // 8B for powerful systems
: "granite3-dense:2b"; // 2B for others
? "granite3.1-dense:8b" // 8B for powerful systems
: "granite3.1-dense:2b"; // 2B for others

return {
defaultChatModel: defaultGraniteModel,
Expand Down
8 changes: 4 additions & 4 deletions src/configureAssistant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export interface AiAssistantConfigurationRequest {
embeddingsModel: string | null;
}

const DEFAULT_CONTEXT_LENGTH = 4096;
const DEFAULT_CONTEXT_LENGTH = 128000;
const DEFAULT_API_BASE = "http://localhost:11434";
const DEFAULT_PROVIDER = "ollama";

Expand All @@ -52,7 +52,7 @@ const baseGraniteConfig: Partial<ModelConfig> = {
...baseConfig,
contextLength: DEFAULT_CONTEXT_LENGTH,
completionOptions: {
maxTokens: DEFAULT_CONTEXT_LENGTH / 2,
maxTokens: DEFAULT_CONTEXT_LENGTH / 4,
temperature: 0,
topP: 0.9,
topK: 40,
Expand All @@ -74,11 +74,11 @@ const modelConfigs: ModelConfig[] = [
contextLength: 128000,
},
{
model: "granite3-dense:2b",
model: "granite3.1-dense:2b",
...baseGraniteConfig,
},
{
model: "granite3-dense:8b",
model: "granite3.1-dense:8b",
...baseGraniteConfig,
},
{
Expand Down
3 changes: 2 additions & 1 deletion src/panels/setupGranitePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import {
WebviewPanel,
window
} from "vscode";
import { DOWNLOADABLE_MODELS, isDevMode } from '../commons/constants';
import { isDevMode } from '../commons/constants';
import { DOWNLOADABLE_MODELS } from '../commons/modelRequirements';
import { ProgressData } from "../commons/progressData";
import { ModelStatus, ServerStatus } from '../commons/statuses';
import { IModelServer } from '../modelServer';
Expand Down
8 changes: 4 additions & 4 deletions webviews/src/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ describe("App Component", () => {
expect(mockPostMessage).toHaveBeenCalledWith({
command: "setupGranite",
data: {
chatModelId: "granite3-dense:2b",
tabModelId: "granite3-dense:2b",
chatModelId: "granite3.1-dense:2b",
tabModelId: "granite3.1-dense:2b",
embeddingsModelId: "nomic-embed-text:latest",
},
});
Expand Down Expand Up @@ -162,8 +162,8 @@ describe("App Component", () => {
expect(mockPostMessage).toHaveBeenCalledWith({
command: "setupGranite",
data: {
chatModelId: "granite3-dense:2b",
tabModelId: "granite3-dense:2b",
chatModelId: "granite3.1-dense:2b",
tabModelId: "granite3.1-dense:2b",
embeddingsModelId: "nomic-embed-text:latest",
},
});
Expand Down
12 changes: 6 additions & 6 deletions webviews/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ import { getRecommendedModels } from "../../src/commons/sysInfo";
function App() {
const modelOptions: ModelOption[] = [
{
label: "granite3-dense:2b",
value: "granite3-dense:2b",
info: formatSize(MODEL_REQUIREMENTS["granite3-dense:2b"].sizeBytes)
label: "granite3.1-dense:2b",
value: "granite3.1-dense:2b",
info: formatSize(MODEL_REQUIREMENTS["granite3.1-dense:2b"].sizeBytes)
},
{
label: "granite3-dense:8b",
value: "granite3-dense:8b",
info: formatSize(MODEL_REQUIREMENTS["granite3-dense:8b"].sizeBytes)
label: "granite3.1-dense:8b",
value: "granite3.1-dense:8b",
info: formatSize(MODEL_REQUIREMENTS["granite3.1-dense:8b"].sizeBytes)
},
{
label: "granite-code:3b",
Expand Down
Loading