fix: cpu_offload is not shown when editting model
This commit is contained in:
@@ -9,7 +9,7 @@ import ListItem from './list-item';
|
|||||||
interface ListInputProps {
|
interface ListInputProps {
|
||||||
dataList: string[];
|
dataList: string[];
|
||||||
label: string;
|
label: string;
|
||||||
description?: string;
|
description?: React.ReactNode;
|
||||||
btnText?: string;
|
btnText?: string;
|
||||||
options?: Global.HintOptions[];
|
options?: Global.HintOptions[];
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
|
|||||||
@@ -46,6 +46,7 @@
|
|||||||
|
|
||||||
table {
|
table {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
margin-bottom: 1.2em;
|
||||||
|
|
||||||
th {
|
th {
|
||||||
font-weight: var(--font-weight-bold);
|
font-weight: var(--font-weight-bold);
|
||||||
|
|||||||
@@ -206,5 +206,6 @@ export default {
|
|||||||
'common.title.delete.confirm': 'Confirm delete',
|
'common.title.delete.confirm': 'Confirm delete',
|
||||||
'common.button.addLabel': 'Add Labels',
|
'common.button.addLabel': 'Add Labels',
|
||||||
'common.button.addSelector': 'Add Selectors',
|
'common.button.addSelector': 'Add Selectors',
|
||||||
'common.button.addParams': 'Add Parameter'
|
'common.button.addParams': 'Add Parameter',
|
||||||
|
'common.text.here': 'here'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -64,5 +64,6 @@ export default {
|
|||||||
'models.form.backend_parameters.llamabox.placeholder':
|
'models.form.backend_parameters.llamabox.placeholder':
|
||||||
'e.g., --ctx-size=8192',
|
'e.g., --ctx-size=8192',
|
||||||
'models.form.backend_parameters.vllm.placeholder':
|
'models.form.backend_parameters.vllm.placeholder':
|
||||||
'e.g., --max-model-len=8192'
|
'e.g., --max-model-len=8192',
|
||||||
|
'models.form.backend_parameters.vllm.tips': 'More {backend} parameter details'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -199,5 +199,6 @@ export default {
|
|||||||
'common.title.delete.confirm': '确认删除',
|
'common.title.delete.confirm': '确认删除',
|
||||||
'common.button.addLabel': '添加标签',
|
'common.button.addLabel': '添加标签',
|
||||||
'common.button.addSelector': '添加选择器',
|
'common.button.addSelector': '添加选择器',
|
||||||
'common.button.addParams': '添加参数'
|
'common.button.addParams': '添加参数',
|
||||||
|
'common.text.here': '这里'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -63,5 +63,6 @@ export default {
|
|||||||
'models.form.backend_parameters.llamabox.placeholder':
|
'models.form.backend_parameters.llamabox.placeholder':
|
||||||
'例如,--ctx-size=8192',
|
'例如,--ctx-size=8192',
|
||||||
'models.form.backend_parameters.vllm.placeholder':
|
'models.form.backend_parameters.vllm.placeholder':
|
||||||
'例如,--max-model-len=8192'
|
'例如,--max-model-len=8192',
|
||||||
|
'models.form.backend_parameters.vllm.tips': '更多 {backend} 参数说明查看'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import LabelSelector from '@/components/label-selector';
|
import LabelSelector from '@/components/label-selector';
|
||||||
import FieldWrapper from '@/components/label-selector/wrapper';
|
|
||||||
import ListInput from '@/components/list-input';
|
import ListInput from '@/components/list-input';
|
||||||
import SealSelect from '@/components/seal-form/seal-select';
|
import SealSelect from '@/components/seal-form/seal-select';
|
||||||
import { PageAction } from '@/config';
|
import { PageAction } from '@/config';
|
||||||
@@ -12,14 +11,13 @@ import {
|
|||||||
Collapse,
|
Collapse,
|
||||||
Form,
|
Form,
|
||||||
FormInstance,
|
FormInstance,
|
||||||
Radio,
|
|
||||||
Select,
|
Select,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
Typography
|
Typography
|
||||||
} from 'antd';
|
} from 'antd';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import React, { useCallback, useMemo } from 'react';
|
import React, { useCallback, useMemo } from 'react';
|
||||||
import { backendOptionsMap } from '../config';
|
import { backendOptionsMap, placementStrategyOptions } from '../config';
|
||||||
import llamaConfig from '../config/llama-config';
|
import llamaConfig from '../config/llama-config';
|
||||||
import { FormData } from '../config/types';
|
import { FormData } from '../config/types';
|
||||||
import vllmConfig from '../config/vllm-config';
|
import vllmConfig from '../config/vllm-config';
|
||||||
@@ -79,6 +77,19 @@ const AdvanceConfig: React.FC<AdvanceConfigProps> = (props) => {
|
|||||||
return backend === backendOptionsMap.llamaBox ? llamaConfig : vllmConfig;
|
return backend === backendOptionsMap.llamaBox ? llamaConfig : vllmConfig;
|
||||||
}, [backend]);
|
}, [backend]);
|
||||||
|
|
||||||
|
const backendParamsTips = useMemo(() => {
|
||||||
|
if (backend === backendOptionsMap.llamaBox) {
|
||||||
|
return {
|
||||||
|
backend: 'llama-box',
|
||||||
|
link: 'https://github.com/gpustack/llama-box?tab=readme-ov-file#usage'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
backend: 'vLLM',
|
||||||
|
link: 'https://docs.vllm.ai/en/stable/serving/openai_compatible_server.html#command-line-arguments-for-the-server'
|
||||||
|
};
|
||||||
|
}, [backend]);
|
||||||
|
|
||||||
const renderSelectTips = (list: Array<{ title: string; tips: string }>) => {
|
const renderSelectTips = (list: Array<{ title: string; tips: string }>) => {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
@@ -119,7 +130,7 @@ const AdvanceConfig: React.FC<AdvanceConfigProps> = (props) => {
|
|||||||
const children = (
|
const children = (
|
||||||
<>
|
<>
|
||||||
<Form.Item name="scheduleType">
|
<Form.Item name="scheduleType">
|
||||||
{/* <SealSelect
|
<SealSelect
|
||||||
label={intl.formatMessage({ id: 'models.form.scheduletype' })}
|
label={intl.formatMessage({ id: 'models.form.scheduletype' })}
|
||||||
description={renderSelectTips(scheduleTypeTips)}
|
description={renderSelectTips(scheduleTypeTips)}
|
||||||
options={[
|
options={[
|
||||||
@@ -136,46 +147,18 @@ const AdvanceConfig: React.FC<AdvanceConfigProps> = (props) => {
|
|||||||
value: 'manual'
|
value: 'manual'
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
></SealSelect> */}
|
></SealSelect>
|
||||||
<FieldWrapper
|
|
||||||
label={intl.formatMessage({ id: 'models.form.scheduletype' })}
|
|
||||||
description={renderSelectTips(scheduleTypeTips)}
|
|
||||||
>
|
|
||||||
<Radio.Group style={{ marginTop: 5 }}>
|
|
||||||
<Radio value="auto">
|
|
||||||
{intl.formatMessage({
|
|
||||||
id: 'models.form.scheduletype.auto'
|
|
||||||
})}
|
|
||||||
</Radio>
|
|
||||||
<Radio value="manual">
|
|
||||||
{intl.formatMessage({
|
|
||||||
id: 'models.form.scheduletype.manual'
|
|
||||||
})}
|
|
||||||
</Radio>
|
|
||||||
</Radio.Group>
|
|
||||||
</FieldWrapper>
|
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
{scheduleType === 'auto' && (
|
{scheduleType === 'auto' && (
|
||||||
<>
|
<>
|
||||||
<Form.Item<FormData> name="placement_strategy">
|
<Form.Item<FormData> name="placement_strategy">
|
||||||
{/* <SealSelect
|
<SealSelect
|
||||||
label={intl.formatMessage({
|
label={intl.formatMessage({
|
||||||
id: 'resources.form.placementStrategy'
|
id: 'resources.form.placementStrategy'
|
||||||
})}
|
})}
|
||||||
options={placementStrategyOptions}
|
options={placementStrategyOptions}
|
||||||
description={renderSelectTips(placementStrategyTips)}
|
description={renderSelectTips(placementStrategyTips)}
|
||||||
></SealSelect> */}
|
></SealSelect>
|
||||||
<FieldWrapper
|
|
||||||
label={intl.formatMessage({
|
|
||||||
id: 'resources.form.placementStrategy'
|
|
||||||
})}
|
|
||||||
description={renderSelectTips(placementStrategyTips)}
|
|
||||||
>
|
|
||||||
<Radio.Group style={{ marginTop: 5 }}>
|
|
||||||
<Radio value="spread">Spread</Radio>
|
|
||||||
<Radio value="binpack">Binpack</Radio>
|
|
||||||
</Radio.Group>
|
|
||||||
</FieldWrapper>
|
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item<FormData>
|
<Form.Item<FormData>
|
||||||
name="worker_selector"
|
name="worker_selector"
|
||||||
@@ -250,7 +233,7 @@ const AdvanceConfig: React.FC<AdvanceConfigProps> = (props) => {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
)}
|
)}
|
||||||
<Form.Item name="backend">
|
<Form.Item name="backend">
|
||||||
{/* <SealSelect
|
<SealSelect
|
||||||
label={intl.formatMessage({ id: 'models.form.backend' })}
|
label={intl.formatMessage({ id: 'models.form.backend' })}
|
||||||
options={[
|
options={[
|
||||||
{
|
{
|
||||||
@@ -265,25 +248,7 @@ const AdvanceConfig: React.FC<AdvanceConfigProps> = (props) => {
|
|||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
disabled={action === PageAction.EDIT}
|
disabled={action === PageAction.EDIT}
|
||||||
></SealSelect> */}
|
></SealSelect>
|
||||||
<FieldWrapper
|
|
||||||
label={intl.formatMessage({ id: 'models.form.backend' })}
|
|
||||||
>
|
|
||||||
<Radio.Group>
|
|
||||||
<Radio
|
|
||||||
value={backendOptionsMap.llamaBox}
|
|
||||||
disabled={!isGGUF || action === PageAction.EDIT}
|
|
||||||
>
|
|
||||||
llama-box(llama.cpp)
|
|
||||||
</Radio>
|
|
||||||
<Radio
|
|
||||||
value={backendOptionsMap.vllm}
|
|
||||||
disabled={isGGUF || action === PageAction.EDIT}
|
|
||||||
>
|
|
||||||
vLLM
|
|
||||||
</Radio>
|
|
||||||
</Radio.Group>
|
|
||||||
</FieldWrapper>
|
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item<FormData> name="backend_parameters">
|
<Form.Item<FormData> name="backend_parameters">
|
||||||
<ListInput
|
<ListInput
|
||||||
@@ -301,6 +266,21 @@ const AdvanceConfig: React.FC<AdvanceConfigProps> = (props) => {
|
|||||||
dataList={form.getFieldValue('backend_parameters') || []}
|
dataList={form.getFieldValue('backend_parameters') || []}
|
||||||
onChange={handleBackendParametersChange}
|
onChange={handleBackendParametersChange}
|
||||||
options={paramsConfig}
|
options={paramsConfig}
|
||||||
|
description={
|
||||||
|
<span>
|
||||||
|
{intl.formatMessage(
|
||||||
|
{ id: 'models.form.backend_parameters.vllm.tips' },
|
||||||
|
{ backend: backendParamsTips.backend }
|
||||||
|
)}{' '}
|
||||||
|
<Typography.Link
|
||||||
|
style={{ color: 'var(--ant-blue-4)' }}
|
||||||
|
href={backendParamsTips.link}
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
|
{intl.formatMessage({ id: 'common.text.here' })}
|
||||||
|
</Typography.Link>
|
||||||
|
</span>
|
||||||
|
}
|
||||||
></ListInput>
|
></ListInput>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
{isGGUF && (
|
{isGGUF && (
|
||||||
|
|||||||
@@ -382,9 +382,7 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
|
|||||||
form={form}
|
form={form}
|
||||||
gpuOptions={gpuOptions}
|
gpuOptions={gpuOptions}
|
||||||
action={PageAction.EDIT}
|
action={PageAction.EDIT}
|
||||||
isGGUF={
|
isGGUF={props.data?.backend === backendOptionsMap.llamaBox}
|
||||||
form.getFieldValue('backend') === backendOptionsMap.llamaBox
|
|
||||||
}
|
|
||||||
></AdvanceConfig>
|
></AdvanceConfig>
|
||||||
</Form>
|
</Form>
|
||||||
</SimpleBar>
|
</SimpleBar>
|
||||||
|
|||||||
Reference in New Issue
Block a user