Skip to content
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
10 changes: 10 additions & 0 deletions packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@
"maximum": 65535,
"description": "Port on which the API is listening (requires restart of extension)"
},
"ai-lab.inferenceRuntime": {
"type": "string",
"enum": [
"all",
"llama-cpp",
"whisper-cpp",
"none"
],
"description": "Choose the default inferencing runtime for AI Lab"
},
"ai-lab.experimentalTuning": {
"type": "boolean",
"default": false,
Expand Down
2 changes: 2 additions & 0 deletions packages/backend/src/managers/modelsManager.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ beforeEach(() => {
modelsPath: '~/downloads',
experimentalTuning: false,
apiPort: 0,
inferenceRuntime: 'llama-cpp',
experimentalGPU: false,
showGPUPromotion: false,
appearance: 'dark',
Expand Down Expand Up @@ -1007,6 +1008,7 @@ describe('uploadModelToPodmanMachine', () => {
modelsPath: '~/downloads',
experimentalTuning: false,
apiPort: 0,
inferenceRuntime: 'llama-cpp',
experimentalGPU: false,
showGPUPromotion: false,
appearance: 'dark',
Expand Down
2 changes: 2 additions & 0 deletions packages/backend/src/registries/ConfigurationRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const CONFIGURATION_SECTIONS: string[] = [
'models.path',
'experimentalGPU',
'apiPort',
'inferenceRuntime',
'experimentalTuning',
'modelUploadDisabled',
'showGPUPromotion',
Expand Down Expand Up @@ -54,6 +55,7 @@ export class ConfigurationRegistry extends Publisher<ExtensionConfiguration> imp
modelsPath: this.getModelsPath(),
experimentalGPU: this.#configuration.get<boolean>('experimentalGPU') ?? false,
apiPort: this.#configuration.get<number>('apiPort') ?? API_PORT_DEFAULT,
inferenceRuntime: this.#configuration.get<string>('inferenceRuntime') ?? 'all',
experimentalTuning: this.#configuration.get<boolean>('experimentalTuning') ?? false,
modelUploadDisabled: this.#configuration.get<boolean>('modelUploadDisabled') ?? false,
showGPUPromotion: this.#configuration.get<boolean>('showGPUPromotion') ?? true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ beforeEach(() => {
experimentalGPU: false,
modelsPath: 'model-path',
apiPort: 10434,
inferenceRuntime: 'llama-cpp',
experimentalTuning: false,
modelUploadDisabled: false,
showGPUPromotion: false,
Expand Down Expand Up @@ -278,6 +279,7 @@ describe('perform', () => {
experimentalGPU: true,
modelsPath: '',
apiPort: 10434,
inferenceRuntime: 'llama-cpp',
experimentalTuning: false,
modelUploadDisabled: false,
showGPUPromotion: false,
Expand Down Expand Up @@ -321,6 +323,7 @@ describe('perform', () => {
experimentalGPU: true,
modelsPath: '',
apiPort: 10434,
inferenceRuntime: 'llama-cpp',
experimentalTuning: false,
modelUploadDisabled: false,
showGPUPromotion: false,
Expand Down Expand Up @@ -369,6 +372,7 @@ describe('perform', () => {
experimentalGPU: true,
modelsPath: '',
apiPort: 10434,
inferenceRuntime: 'llama-cpp',
experimentalTuning: false,
modelUploadDisabled: false,
showGPUPromotion: false,
Expand Down Expand Up @@ -417,6 +421,7 @@ describe('perform', () => {
experimentalGPU: true,
modelsPath: '',
apiPort: 10434,
inferenceRuntime: 'llama-cpp',
experimentalTuning: false,
modelUploadDisabled: false,
showGPUPromotion: false,
Expand Down Expand Up @@ -453,6 +458,7 @@ describe('perform', () => {
experimentalGPU: true,
modelsPath: '',
apiPort: 10434,
inferenceRuntime: 'llama-cpp',
experimentalTuning: false,
modelUploadDisabled: false,
showGPUPromotion: false,
Expand Down Expand Up @@ -498,6 +504,7 @@ describe('perform', () => {
experimentalGPU: true,
modelsPath: '',
apiPort: 10434,
inferenceRuntime: 'llama-cpp',
experimentalTuning: false,
modelUploadDisabled: false,
showGPUPromotion: false,
Expand Down Expand Up @@ -537,6 +544,7 @@ describe('perform', () => {
experimentalGPU: true,
modelsPath: '',
apiPort: 10434,
inferenceRuntime: 'llama-cpp',
experimentalTuning: false,
modelUploadDisabled: false,
showGPUPromotion: false,
Expand Down Expand Up @@ -581,6 +589,7 @@ describe('perform', () => {
experimentalGPU: true,
modelsPath: '',
apiPort: 10434,
inferenceRuntime: 'llama-cpp',
experimentalTuning: false,
modelUploadDisabled: false,
showGPUPromotion: false,
Expand Down
1 change: 1 addition & 0 deletions packages/backend/src/workers/provider/OpenVINO.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ beforeEach(() => {
experimentalGPU: false,
modelsPath: 'model-path',
apiPort: 10434,
inferenceRuntime: 'llama-cpp',
experimentalTuning: false,
modelUploadDisabled: false,
showGPUPromotion: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ beforeEach(() => {
apiPort: 0,
experimentalTuning: false,
modelsPath: '',
inferenceRuntime: 'llama-cpp',
modelUploadDisabled: false,
showGPUPromotion: false,
appearance: 'dark',
Expand Down
6 changes: 6 additions & 0 deletions packages/frontend/src/lib/notification/GPUPromotion.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const mockConfiguration: Writable<ExtensionConfiguration> = writable({
experimentalGPU: false,
modelsPath: '',
apiPort: -1,
inferenceRuntime: 'llama-cpp',
modelUploadDisabled: false,
experimentalTuning: false,
showGPUPromotion: false,
Expand All @@ -64,6 +65,7 @@ test('should show banner if gpu support if off and gpu promotion on', async () =
showGPUPromotion: true,
modelUploadDisabled: false,
modelsPath: '',
inferenceRuntime: 'llama-cpp',
experimentalTuning: false,
apiPort: -1,
appearance: 'dark',
Expand All @@ -85,6 +87,7 @@ test('should not show banner if gpu support if on and gpu promotion on', async (
showGPUPromotion: true,
modelUploadDisabled: false,
modelsPath: '',
inferenceRuntime: 'llama-cpp',
experimentalTuning: false,
apiPort: -1,
appearance: 'dark',
Expand All @@ -106,6 +109,7 @@ test('should not show banner if gpu support if off and gpu promotion off', async
showGPUPromotion: false,
modelUploadDisabled: false,
modelsPath: '',
inferenceRuntime: 'llama-cpp',
experimentalTuning: false,
apiPort: -1,
appearance: 'dark',
Expand All @@ -128,6 +132,7 @@ test('click enable should call client', async () => {
showGPUPromotion: true,
modelUploadDisabled: false,
modelsPath: '',
inferenceRuntime: 'llama-cpp',
experimentalTuning: false,
apiPort: -1,
appearance: 'dark',
Expand Down Expand Up @@ -155,6 +160,7 @@ test('click hide should call client', async () => {
showGPUPromotion: true,
modelUploadDisabled: false,
modelsPath: '',
inferenceRuntime: 'llama-cpp',
experimentalTuning: false,
apiPort: -1,
appearance: 'dark',
Expand Down
1 change: 1 addition & 0 deletions packages/frontend/src/pages/CreateService.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ beforeEach(() => {
vi.mocked(studioClient.getExtensionConfiguration).mockResolvedValue({
experimentalGPU: false,
apiPort: 0,
inferenceRuntime: 'llama-cpp',
experimentalTuning: false,
modelsPath: '',
modelUploadDisabled: false,
Expand Down
18 changes: 18 additions & 0 deletions packages/frontend/src/pages/NewInstructLabSession.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ vi.mock('../utils/client', async () => ({
studioClient: {
openURL: vi.fn(),
openDialog: vi.fn(),
getExtensionConfiguration: vi.fn(),
},
rpcBrowser: {
subscribe: (): unknown => {
return {
unsubscribe: (): void => {},
};
},
},
}));

Expand All @@ -53,6 +61,16 @@ beforeEach(() => {

const infos: Writable<ModelInfo[]> = writable([]);
vi.mocked(modelsInfo).subscribe.mockImplementation(run => infos.subscribe(run));
vi.mocked(studioClient.getExtensionConfiguration).mockResolvedValue({
experimentalGPU: false,
apiPort: 0,
experimentalTuning: false,
modelsPath: '',
inferenceRuntime: 'llama-cpp',
modelUploadDisabled: false,
showGPUPromotion: false,
appearance: 'dark',
});
});

test('empty form should have submit disabled', async () => {
Expand Down
1 change: 1 addition & 0 deletions packages/frontend/src/pages/PlaygroundCreate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ vi.mock('../utils/client', async () => {
return {
studioClient: {
requestCreatePlayground: vi.fn(),
getExtensionConfiguration: vi.fn().mockResolvedValue({}),
},
rpcBrowser: {
subscribe: (): unknown => {
Expand Down
18 changes: 18 additions & 0 deletions packages/frontend/src/pages/Recipes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ vi.mock('/@/stores/catalog', async () => {
vi.mock('../utils/client', async () => ({
studioClient: {
filterRecipes: vi.fn(),
getExtensionConfiguration: vi.fn().mockResolvedValue({}),
},
rpcBrowser: {
subscribe: (): unknown => {
return {
unsubscribe: (): void => {},
};
},
},
}));

Expand Down Expand Up @@ -104,6 +112,16 @@ beforeEach(() => {
filters: {},
choices: {},
});
vi.mocked(studioClient.getExtensionConfiguration).mockResolvedValue({
experimentalGPU: false,
apiPort: 0,
experimentalTuning: false,
modelsPath: '',
inferenceRuntime: 'llama-cpp',
modelUploadDisabled: false,
showGPUPromotion: false,
appearance: 'dark',
});
});

test('recipe without category should be visible', async () => {
Expand Down
11 changes: 11 additions & 0 deletions packages/frontend/src/pages/Recipes.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { Fa } from 'svelte-fa';
import { faGithub } from '@fortawesome/free-brands-svg-icons'; // Import the GitHub icon
import { studioClient } from '../utils/client';
import type { CatalogFilterKey, Choice, RecipeChoices, RecipeFilters } from '@shared/models/FilterRecipesResult';
import { onMount } from 'svelte';
import { configuration } from '../stores/extensionConfiguration';

// filters available in the dropdowns for the user to select
let choices: RecipeChoices = $state({});
Expand Down Expand Up @@ -100,6 +102,14 @@ const filtersComponents: { label: string; key: CatalogFilterKey }[] = [
function openContribution(): void {
studioClient.openURL('https://github.com/containers/ai-lab-recipes/blob/main/CONTRIBUTING.md').catch(console.error);
}

let defaultRuntime: string | undefined = $state();

onMount(() => {
const inferenceRuntime = $configuration?.inferenceRuntime;
if (inferenceRuntime) defaultRuntime = inferenceRuntime;
if (inferenceRuntime !== 'all') onFilterChange('tools', defaultRuntime ?? '');
});
</script>

<NavPage title="Recipe Catalog" searchEnabled={false}>
Expand Down Expand Up @@ -134,6 +144,7 @@ function openContribution(): void {
<label for={filterComponent.key} class="block mb-2 text-sm font-medium">{filterComponent.label}</label>
<Dropdown
id={filterComponent.key}
value={filterComponent.key === 'tools' ? defaultRuntime : ''}
options={choicesToOptions(choices[filterComponent.key])}
onChange={(v): void => onFilterChange(filterComponent.key, v)}></Dropdown>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const mockConfiguration: Writable<ExtensionConfiguration> = writable({
modelUploadDisabled: false,
experimentalTuning: false,
showGPUPromotion: false,
inferenceRuntime: 'llama-cpp',
appearance: 'dark',
});

Expand All @@ -75,6 +76,7 @@ test('renders Start Fine Tuning button if experimentalTuning is true', async ()
modelUploadDisabled: false,
modelsPath: '',
experimentalTuning: true,
inferenceRuntime: 'llama-cpp',
apiPort: -1,
appearance: 'dark',
});
Expand All @@ -89,6 +91,7 @@ test('does not render Start Fine Tuning button if experimentalTuning is false',
modelUploadDisabled: false,
modelsPath: '',
experimentalTuning: false,
inferenceRuntime: 'llama-cpp',
apiPort: -1,
appearance: 'dark',
});
Expand All @@ -103,6 +106,7 @@ test('navigates to /tune/start when Start Fine Tuning is clicked', async () => {
modelUploadDisabled: false,
modelsPath: '',
experimentalTuning: true,
inferenceRuntime: 'llama-cpp',
apiPort: -1,
appearance: 'dark',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const mockConfiguration: Writable<ExtensionConfiguration> = writable({
experimentalGPU: false,
modelsPath: '',
apiPort: 10434,
inferenceRuntime: 'llama-cpp',
modelUploadDisabled: false,
experimentalTuning: false,
showGPUPromotion: false,
Expand Down
1 change: 1 addition & 0 deletions packages/shared/src/models/IExtensionConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface ExtensionConfiguration {
experimentalGPU: boolean;
modelsPath: string;
apiPort: number;
inferenceRuntime: string;
experimentalTuning: boolean;
modelUploadDisabled: boolean;
showGPUPromotion: boolean;
Expand Down
Loading