fix: schdule type gpu_selctor issue
This commit is contained in:
@@ -158,7 +158,7 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
||||
return {
|
||||
gpu_selector: {
|
||||
gpu_ids: [gpuids[0]],
|
||||
gpus_per_replica: -1
|
||||
gpus_per_replica: null
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -352,7 +352,7 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
||||
name="deployModel"
|
||||
form={form}
|
||||
onFinish={handleOk}
|
||||
preserve={true}
|
||||
preserve={false}
|
||||
clearOnDestroy={true}
|
||||
onValuesChange={handleOnValuesChange}
|
||||
onFinishFailed={handleOnFinishFailed}
|
||||
|
||||
@@ -2,7 +2,7 @@ import CheckboxField from '@/components/seal-form/checkbox-field';
|
||||
import SealInputNumber from '@/components/seal-form/input-number';
|
||||
import { useIntl } from '@umijs/max';
|
||||
import { Form } from 'antd';
|
||||
import { useMemo } from 'react';
|
||||
import { useMemo, useRef } from 'react';
|
||||
import { backendOptionsMap } from '../config/backend-parameters';
|
||||
import { useFormContext } from '../config/form-context';
|
||||
import { FormData } from '../config/types';
|
||||
@@ -13,18 +13,20 @@ const KVCacheForm = () => {
|
||||
const { onValuesChange, backendOptions } = useFormContext();
|
||||
const kvCacheEnabled = Form.useWatch(['extended_kv_cache', 'enabled'], form);
|
||||
const backend = Form.useWatch('backend', form);
|
||||
const configCacheRef = useRef<any>({});
|
||||
|
||||
const handleOnChange = async (e: any) => {
|
||||
const extendedKVCache = form.getFieldValue('extended_kv_cache');
|
||||
if (e.target.checked) {
|
||||
form.setFieldsValue({
|
||||
extended_kv_cache: {
|
||||
enabled: true,
|
||||
chunk_size: extendedKVCache?.chunk_size,
|
||||
ram_ratio: extendedKVCache?.ram_ratio || 1.2,
|
||||
ram_size: extendedKVCache?.ram_size
|
||||
chunk_size: configCacheRef.current?.chunk_size,
|
||||
ram_ratio: configCacheRef.current?.ram_ratio || 1.2,
|
||||
ram_size: configCacheRef.current?.ram_size
|
||||
}
|
||||
});
|
||||
} else {
|
||||
configCacheRef.current = form.getFieldValue('extended_kv_cache');
|
||||
}
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 200);
|
||||
|
||||
@@ -77,7 +77,7 @@ const ScheduleTypeForm: React.FC = () => {
|
||||
return;
|
||||
}
|
||||
if (value === ScheduleValueMap.Manual) {
|
||||
form.setFieldValue(['gpu_selector', 'gpus_per_replica'], -1);
|
||||
form.setFieldValue(['gpu_selector', 'gpus_per_replica'], null);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -180,10 +180,11 @@ const ScheduleTypeForm: React.FC = () => {
|
||||
label={intl.formatMessage({
|
||||
id: 'models.form.gpusperreplica'
|
||||
})}
|
||||
allowNull
|
||||
options={[
|
||||
{
|
||||
label: intl.formatMessage({ id: 'common.options.auto' }),
|
||||
value: -1
|
||||
value: null
|
||||
},
|
||||
{ label: '1', value: 1 },
|
||||
{ label: '2', value: 2 },
|
||||
|
||||
Reference in New Issue
Block a user