-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[OPENVINO-CODE] add-device-options (#895)
- Loading branch information
Showing
11 changed files
with
210 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Features } from './features'; | ||
|
||
enum DeviceId { | ||
CPU = 'CPU', | ||
GPU = 'GPU', | ||
NPU = 'NPU', | ||
} | ||
|
||
export enum DeviceName { | ||
CPU = 'CPU', | ||
GPU = 'GPU', | ||
NPU = 'NPU', | ||
} | ||
|
||
export const DEVICE_NAME_TO_ID_MAP: Record<DeviceName, DeviceId> = { | ||
[DeviceName.CPU]: DeviceId.CPU, | ||
[DeviceName.GPU]: DeviceId.GPU, | ||
[DeviceName.NPU]: DeviceId.NPU, | ||
}; | ||
|
||
export const DEVICE_SUPPORTED_FEATURES: Record<DeviceName, Features[]> = { | ||
[DeviceName.CPU]: [Features.CODE_COMPLETION, Features.SUMMARIZATION, Features.FIM], | ||
[DeviceName.GPU]: [Features.CODE_COMPLETION, Features.SUMMARIZATION, Features.FIM], | ||
[DeviceName.NPU]: [Features.CODE_COMPLETION, Features.SUMMARIZATION, Features.FIM], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...no_code/side-panel-ui/src/components/sections/ServerSection/DeviceSelect/DeviceSelect.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
//import { ModelName } from '@shared/model'; | ||
import { DeviceName } from '@shared/device'; | ||
import { Select, SelectOptionProps } from '../../../shared/Select/Select'; | ||
import { ServerStatus } from '@shared/server-state'; | ||
import { Features } from '@shared/features'; | ||
|
||
const options: SelectOptionProps<DeviceName>[] = [ | ||
{ value: DeviceName.CPU }, | ||
{ value: DeviceName.GPU }, | ||
{ value: DeviceName.NPU }, | ||
]; | ||
|
||
interface DeviceSelectProps { | ||
disabled: boolean; | ||
selectedDeviceName: DeviceName; | ||
onChange: (deviceName: DeviceName) => void; | ||
supportedFeatures: Features[]; | ||
serverStatus: ServerStatus; | ||
} | ||
|
||
export const DeviceSelect = ({ | ||
disabled, | ||
selectedDeviceName, | ||
onChange, | ||
supportedFeatures, | ||
serverStatus, | ||
}: DeviceSelectProps): JSX.Element => { | ||
const isServerStopped = serverStatus === ServerStatus.STOPPED; | ||
return ( | ||
<> | ||
<Select | ||
label="Device" | ||
options={options} | ||
selectedValue={selectedDeviceName} | ||
disabled={disabled} | ||
onChange={(value) => onChange(value)} | ||
></Select> | ||
{isServerStopped && <span>Supported Features: {supportedFeatures.join(', ')}</span>} | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.