fix: check driver command for adding worker
This commit is contained in:
@@ -5,6 +5,11 @@
|
|||||||
color: var(--ant-color-text-tertiary);
|
color: var(--ant-color-text-tertiary);
|
||||||
font-size: var(--font-size-base);
|
font-size: var(--font-size-base);
|
||||||
|
|
||||||
|
> span {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
.note-info {
|
.note-info {
|
||||||
margin-left: 4px;
|
margin-left: 4px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import AutoTooltip from '@/components/auto-tooltip';
|
import AutoTooltip from '@/components/auto-tooltip';
|
||||||
import DropDownActions from '@/components/drop-down-actions';
|
import DropDownActions from '@/components/drop-down-actions';
|
||||||
import IconFont from '@/components/icon-font';
|
import IconFont from '@/components/icon-font';
|
||||||
|
import TagWrapper from '@/components/tags-wrapper';
|
||||||
import ThemeTag from '@/components/tags-wrapper/theme-tag';
|
import ThemeTag from '@/components/tags-wrapper/theme-tag';
|
||||||
import Card from '@/components/templates/card';
|
import Card from '@/components/templates/card';
|
||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
@@ -89,6 +90,7 @@ const Content = styled.div`
|
|||||||
|
|
||||||
const InfoItem = styled.div`
|
const InfoItem = styled.div`
|
||||||
display: grid;
|
display: grid;
|
||||||
|
width: 100%;
|
||||||
grid-template-columns: max-content 1fr;
|
grid-template-columns: max-content 1fr;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
@@ -103,12 +105,6 @@ const InfoItem = styled.div`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const BackendBox = styled.div`
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
|
||||||
`;
|
|
||||||
|
|
||||||
interface BackendCardProps {
|
interface BackendCardProps {
|
||||||
onClick?: (data: any) => void;
|
onClick?: (data: any) => void;
|
||||||
onSelect?: (item: any) => void;
|
onSelect?: (item: any) => void;
|
||||||
@@ -151,6 +147,25 @@ const BackendCard: React.FC<BackendCardProps> = ({ data, onSelect }) => {
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const renderTag = (item: any) => {
|
||||||
|
return (
|
||||||
|
<AutoTooltip
|
||||||
|
ghost
|
||||||
|
minWidth={20}
|
||||||
|
showTitle
|
||||||
|
title={_.join(data.framework_index_map?.[item], ', ') || false}
|
||||||
|
>
|
||||||
|
<ThemeTag
|
||||||
|
key={item}
|
||||||
|
style={{ marginRight: 0 }}
|
||||||
|
color={getGpuColor(item)}
|
||||||
|
>
|
||||||
|
{item}
|
||||||
|
</ThemeTag>
|
||||||
|
</AutoTooltip>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const renderFrameworks = () => {
|
const renderFrameworks = () => {
|
||||||
const frameworks = _.keys(data.framework_index_map || {});
|
const frameworks = _.keys(data.framework_index_map || {});
|
||||||
|
|
||||||
@@ -162,31 +177,11 @@ const BackendCard: React.FC<BackendCardProps> = ({ data, onSelect }) => {
|
|||||||
{intl.formatMessage({ id: 'backend.availableFrameworks' })}:{' '}
|
{intl.formatMessage({ id: 'backend.availableFrameworks' })}:{' '}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
<TagWrapper
|
||||||
<BackendBox>
|
gap={8}
|
||||||
{_.take(frameworks, 3).map((item: string) => {
|
dataList={frameworks}
|
||||||
return (
|
renderTag={renderTag}
|
||||||
<div key={item}>
|
></TagWrapper>
|
||||||
<AutoTooltip
|
|
||||||
ghost
|
|
||||||
minWidth={20}
|
|
||||||
showTitle
|
|
||||||
title={
|
|
||||||
_.join(data.framework_index_map?.[item], ', ') || false
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<ThemeTag
|
|
||||||
key={item}
|
|
||||||
style={{ marginRight: 0 }}
|
|
||||||
color={getGpuColor(item)}
|
|
||||||
>
|
|
||||||
{item}
|
|
||||||
</ThemeTag>
|
|
||||||
</AutoTooltip>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</BackendBox>
|
|
||||||
</InfoItem>
|
</InfoItem>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -91,20 +91,14 @@ export const gpuColorMap: Record<string, string> = {
|
|||||||
rocm: 'volcano',
|
rocm: 'volcano',
|
||||||
dtk: 'magenta',
|
dtk: 'magenta',
|
||||||
musa: 'cyan',
|
musa: 'cyan',
|
||||||
corex: 'purple'
|
corex: 'purple',
|
||||||
|
maca: 'geekblue'
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getGpuColor = (gpuType: string) => {
|
export const getGpuColor = (gpuType: string) => {
|
||||||
if (!gpuType) return 'default';
|
if (!gpuType) return 'default';
|
||||||
|
|
||||||
if (gpuType.includes('cann')) return gpuColorMap['cann'];
|
return gpuColorMap[gpuType] || 'default';
|
||||||
if (gpuType.includes('cuda')) return gpuColorMap['cuda'];
|
|
||||||
if (gpuType.includes('rocm')) return gpuColorMap['rocm'];
|
|
||||||
if (gpuType.includes('dtk')) return gpuColorMap['dtk'];
|
|
||||||
if (gpuType.includes('musa')) return gpuColorMap['musa'];
|
|
||||||
if (gpuType.includes('corex')) return gpuColorMap['corex'];
|
|
||||||
|
|
||||||
return 'default';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const customIcons = [
|
export const customIcons = [
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ type ViewModalProps = {
|
|||||||
|
|
||||||
const AddWorkerCommand: React.FC<ViewModalProps> = ({ registrationInfo }) => {
|
const AddWorkerCommand: React.FC<ViewModalProps> = ({ registrationInfo }) => {
|
||||||
const code = React.useMemo(() => {
|
const code = React.useMemo(() => {
|
||||||
const commandCode = addWorkerGuide['cuda'];
|
const commandCode = addWorkerGuide['all'];
|
||||||
return commandCode?.registerWorker({
|
return commandCode?.registerWorker({
|
||||||
server: registrationInfo.server_url || origin,
|
server: registrationInfo.server_url || origin,
|
||||||
tag: '',
|
tag: '',
|
||||||
|
|||||||
@@ -13,9 +13,10 @@ const AddWorkerCommand: React.FC<ViewModalProps> = ({
|
|||||||
currentGPU
|
currentGPU
|
||||||
}) => {
|
}) => {
|
||||||
const code = React.useMemo(() => {
|
const code = React.useMemo(() => {
|
||||||
const command = addWorkerGuide['cuda'];
|
const configs = addWorkerGuide['all'];
|
||||||
return command.checkEnvCommand[provider || ''];
|
const command = configs.checkEnvCommand(currentGPU);
|
||||||
}, [provider]);
|
return command[provider || ''];
|
||||||
|
}, [provider, currentGPU]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HighlightCode
|
<HighlightCode
|
||||||
|
|||||||
@@ -26,6 +26,49 @@ interface SupportedHardwareProps {
|
|||||||
clickable?: boolean;
|
clickable?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const GPUsConfigs = {
|
||||||
|
cuda: {
|
||||||
|
label: 'NVIDIA',
|
||||||
|
value: 'cuda',
|
||||||
|
runtime: 'nvidia'
|
||||||
|
},
|
||||||
|
rocm: {
|
||||||
|
label: 'AMD',
|
||||||
|
value: 'rocm',
|
||||||
|
runtime: 'rocm'
|
||||||
|
},
|
||||||
|
npu: {
|
||||||
|
label: 'Ascend',
|
||||||
|
value: 'npu',
|
||||||
|
runtime: 'ascend'
|
||||||
|
},
|
||||||
|
dcu: {
|
||||||
|
label: 'Hygon',
|
||||||
|
value: 'dcu',
|
||||||
|
runtime: 'dcu'
|
||||||
|
},
|
||||||
|
musa: {
|
||||||
|
label: 'Moore Threads',
|
||||||
|
value: 'musa',
|
||||||
|
runtime: 'musa'
|
||||||
|
},
|
||||||
|
corex: {
|
||||||
|
label: 'Iluvatar',
|
||||||
|
value: 'corex',
|
||||||
|
runtime: 'corex'
|
||||||
|
},
|
||||||
|
cambricon: {
|
||||||
|
label: 'Cambricon',
|
||||||
|
value: 'cambricon',
|
||||||
|
runtime: 'cambricon'
|
||||||
|
},
|
||||||
|
metax: {
|
||||||
|
label: 'MetaX',
|
||||||
|
value: 'metax',
|
||||||
|
runtime: 'metax'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const SupportedHardware: React.FC<SupportedHardwareProps> = ({
|
const SupportedHardware: React.FC<SupportedHardwareProps> = ({
|
||||||
onSelect,
|
onSelect,
|
||||||
clickable,
|
clickable,
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ const CatalogItem: React.FC<CatalogItemProps> = (props) => {
|
|||||||
e.target.src = fallbackImg;
|
e.target.src = fallbackImg;
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderTag = (sItem: any) => {
|
const renderTag = useCallback((sItem: any) => {
|
||||||
return (
|
return (
|
||||||
<ThemeTag
|
<ThemeTag
|
||||||
key={sItem}
|
key={sItem}
|
||||||
@@ -50,7 +50,7 @@ const CatalogItem: React.FC<CatalogItemProps> = (props) => {
|
|||||||
{sItem}B
|
{sItem}B
|
||||||
</ThemeTag>
|
</ThemeTag>
|
||||||
);
|
);
|
||||||
};
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -72,10 +72,15 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
|||||||
// voxbox is not support multi gpu
|
// voxbox is not support multi gpu
|
||||||
const updateGPUSelector = (backend: string) => {
|
const updateGPUSelector = (backend: string) => {
|
||||||
const gpuids = form.getFieldValue(['gpu_selector', 'gpu_ids']) || [];
|
const gpuids = form.getFieldValue(['gpu_selector', 'gpu_ids']) || [];
|
||||||
|
const gpusPerReplicas =
|
||||||
|
form.getFieldValue(['gpu_selector', 'gpus_per_replica']) || null;
|
||||||
|
|
||||||
if (backend === backendOptionsMap.voxBox && gpuids.length > 0) {
|
if (backend === backendOptionsMap.voxBox && gpuids.length > 0) {
|
||||||
return {
|
return {
|
||||||
gpu_selector: { gpu_ids: [gpuids[0]] }
|
gpusCountType: gpusCountTypeMap.Auto,
|
||||||
|
gpu_selector: {
|
||||||
|
gpu_ids: [gpuids[0]]
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
@@ -131,9 +136,7 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
|||||||
getGPUOptionList({ clusterId: value });
|
getGPUOptionList({ clusterId: value });
|
||||||
getBackendOptions({ cluster_id: value });
|
getBackendOptions({ cluster_id: value });
|
||||||
if (scheduleType === ScheduleValueMap.Manual) {
|
if (scheduleType === ScheduleValueMap.Manual) {
|
||||||
form.setFieldsValue({
|
form.setFieldValue(['gpu_selector', 'gpu_ids'], []);
|
||||||
gpu_selector: { gpu_ids: [] }
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ const ScheduleTypeForm: React.FC = () => {
|
|||||||
const form = Form.useFormInstance();
|
const form = Form.useFormInstance();
|
||||||
const scheduleType = Form.useWatch('scheduleType', form);
|
const scheduleType = Form.useWatch('scheduleType', form);
|
||||||
const gpusCountType = Form.useWatch('gpusCountType', form);
|
const gpusCountType = Form.useWatch('gpusCountType', form);
|
||||||
const gpuSelectorIds = Form.useWatch(['gpu_selector', 'gpu_ids'], form);
|
|
||||||
|
|
||||||
const handleScheduleTypeChange = (value: string) => {
|
const handleScheduleTypeChange = (value: string) => {
|
||||||
if (value === ScheduleValueMap.Auto) {
|
if (value === ScheduleValueMap.Auto) {
|
||||||
@@ -61,9 +60,10 @@ const ScheduleTypeForm: React.FC = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleGpusCountTypeChange = (val: string) => {
|
const handleGpusCountTypeChange = (val: string) => {
|
||||||
if (val === 'custom') {
|
if (val === gpusCountTypeMap.Custom) {
|
||||||
form.setFieldValue(['gpu_selector', 'gpus_per_replica'], 2);
|
form.setFieldValue(['gpu_selector', 'gpus_per_replica'], 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
onValuesChange?.({}, form.getFieldsValue());
|
onValuesChange?.({}, form.getFieldsValue());
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -91,6 +91,12 @@ const ScheduleTypeForm: React.FC = () => {
|
|||||||
onValuesChange?.({}, form.getFieldsValue());
|
onValuesChange?.({}, form.getFieldsValue());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleOnStepReplica = (value: number | null) => {
|
||||||
|
if (value === null) {
|
||||||
|
form.setFieldValue(['gpu_selector', 'gpus_per_replica'], 1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Form.Item name="scheduleType">
|
<Form.Item name="scheduleType">
|
||||||
@@ -187,6 +193,7 @@ const ScheduleTypeForm: React.FC = () => {
|
|||||||
})}
|
})}
|
||||||
min={1}
|
min={1}
|
||||||
step={1}
|
step={1}
|
||||||
|
onChange={handleOnStepReplica}
|
||||||
onStep={handleOnStepReplicaStep}
|
onStep={handleOnStepReplicaStep}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|||||||
@@ -34,9 +34,9 @@ export const llmInitialValues = {
|
|||||||
stop: null,
|
stop: null,
|
||||||
temperature: 1,
|
temperature: 1,
|
||||||
top_p: 1,
|
top_p: 1,
|
||||||
max_tokens: null,
|
max_tokens: 1024,
|
||||||
frequency_penalty: null,
|
frequency_penalty: 0,
|
||||||
presence_penalty: null
|
presence_penalty: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
export const advancedFieldsDefaultValus = {
|
export const advancedFieldsDefaultValus = {
|
||||||
|
|||||||
@@ -34,6 +34,57 @@ export const status: any = {
|
|||||||
[WorkerStatusMap.initializing]: StatusMaps.transitioning
|
[WorkerStatusMap.initializing]: StatusMaps.transitioning
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const GPUsConfigs: Record<string, any> = {
|
||||||
|
cuda: {
|
||||||
|
label: 'NVIDIA',
|
||||||
|
value: 'cuda',
|
||||||
|
runtime: 'nvidia',
|
||||||
|
driver: 'nvidia-smi'
|
||||||
|
},
|
||||||
|
rocm: {
|
||||||
|
label: 'AMD',
|
||||||
|
value: 'rocm',
|
||||||
|
runtime: 'rocm',
|
||||||
|
driver: 'rocm-smi'
|
||||||
|
},
|
||||||
|
npu: {
|
||||||
|
label: 'Ascend',
|
||||||
|
value: 'npu',
|
||||||
|
runtime: 'ascend',
|
||||||
|
driver: 'npu-smi'
|
||||||
|
},
|
||||||
|
dcu: {
|
||||||
|
label: 'Hygon',
|
||||||
|
value: 'dcu',
|
||||||
|
runtime: 'dcu', // TODO: confirm runtime name
|
||||||
|
driver: 'hy-smi'
|
||||||
|
},
|
||||||
|
musa: {
|
||||||
|
label: 'Moore Threads',
|
||||||
|
value: 'musa',
|
||||||
|
runtime: 'mthreads',
|
||||||
|
driver: 'mthreads-gmi'
|
||||||
|
},
|
||||||
|
corex: {
|
||||||
|
label: 'Iluvatar',
|
||||||
|
value: 'corex',
|
||||||
|
runtime: 'corex', // TODO: confirm runtime name
|
||||||
|
driver: 'ixsmi'
|
||||||
|
},
|
||||||
|
cambricon: {
|
||||||
|
label: 'Cambricon',
|
||||||
|
value: 'cambricon',
|
||||||
|
runtime: 'cambricon',
|
||||||
|
driver: 'cnmon'
|
||||||
|
},
|
||||||
|
metax: {
|
||||||
|
label: 'MetaX',
|
||||||
|
value: 'metax',
|
||||||
|
runtime: 'metax',
|
||||||
|
driver: 'mx-smi'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
export const addWorkerGuide: Record<string, any> = {
|
export const addWorkerGuide: Record<string, any> = {
|
||||||
mac: {
|
mac: {
|
||||||
getToken: 'cat /var/lib/gpustack/token',
|
getToken: 'cat /var/lib/gpustack/token',
|
||||||
@@ -48,7 +99,7 @@ export const addWorkerGuide: Record<string, any> = {
|
|||||||
return `Invoke-Expression "& { $((Invoke-WebRequest -Uri 'https://get.gpustack.ai' -UseBasicParsing).Content) } --server-url '${params.server}' --registration-token '${params.token}'"`;
|
return `Invoke-Expression "& { $((Invoke-WebRequest -Uri 'https://get.gpustack.ai' -UseBasicParsing).Content) } --server-url '${params.server}' --registration-token '${params.token}'"`;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
cuda: {
|
all: {
|
||||||
getToken:
|
getToken:
|
||||||
'Get-Content -Path (Join-Path -Path $env:APPDATA -ChildPath "gpustack\\token") -Raw',
|
'Get-Content -Path (Join-Path -Path $env:APPDATA -ChildPath "gpustack\\token") -Raw',
|
||||||
registerWorker(params: {
|
registerWorker(params: {
|
||||||
@@ -69,10 +120,12 @@ export const addWorkerGuide: Record<string, any> = {
|
|||||||
--registration-token ${params.token} \\
|
--registration-token ${params.token} \\
|
||||||
--worker-ip ${params.workerip}`;
|
--worker-ip ${params.workerip}`;
|
||||||
},
|
},
|
||||||
checkEnvCommand: {
|
checkEnvCommand(gpu: string) {
|
||||||
[ProviderValueMap.Docker]: `nvidia-smi >/dev/null 2>&1 && echo "NVIDIA driver OK" || (echo "NVIDIA driver issue"; exit 1) && docker info 2>/dev/null | grep -q "Default Runtime: nvidia" && echo "NVIDIA Container Toolkit OK" || (echo "NVIDIA Container Toolkit not configured"; exit 1)`,
|
const config = GPUsConfigs[gpu];
|
||||||
[ProviderValueMap.Kubernetes]:
|
return {
|
||||||
'kubectl get runtimeclass nvidia > /dev/null 2>&1 && echo "NVIDIA runtimeclass registered" || (echo "NVIDIA runtimeclass issue"; exit 1)'
|
[ProviderValueMap.Docker]: `${config.driver} >/dev/null 2>&1 && echo "${config.label} driver OK" || (echo "${config.label} driver issue"; exit 1) && docker info 2>/dev/null | grep -q "Default Runtime: ${config.runtime}" && echo "${config.label} Container Toolkit OK" || (echo "${config.label} Container Toolkit not configured"; exit 1)`,
|
||||||
|
[ProviderValueMap.Kubernetes]: `kubectl get runtimeclass ${config.runtime} > /dev/null 2>&1 && echo "${config.label} runtimeclass registered" || (echo "${config.label} runtimeclass issue"; exit 1)`
|
||||||
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
npu: {
|
npu: {
|
||||||
|
|||||||
Reference in New Issue
Block a user