Skip to content

Commit b733b36

Browse files
committed
fix: remove input box for gpus_per_replica
1 parent e9fa3e3 commit b733b36

File tree

3 files changed

+18
-51
lines changed

3 files changed

+18
-51
lines changed

src/pages/llmodels/config/index.ts

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -326,12 +326,13 @@ export const modelLabels = [
326326
{ label: 'Embedding', value: 'embedding_only' }
327327
];
328328

329-
// do not trigger form check compatibility when these fields change
329+
// do not trigger form check compatibility when these fields change, maybe triggered manually
330330
export const DO_NOT_TRIGGER_CHECK_COMPATIBILITY = [
331331
'model_scope_model_id',
332332
'huggingface_repo_id',
333333
'huggingface_filename',
334334
'model_scope_file_path',
335+
'replicas',
335336
'name',
336337
'description',
337338
'env',
@@ -356,27 +357,6 @@ export const DO_NOT_TRIGGER_CHECK_COMPATIBILITY = [
356357
// ignore to compare old and new data when these fields change in updating model
357358
export const DO_NOT_NOTIFY_RECREATE = ['categories', 'replicas', 'description'];
358359

359-
// if some fields need to trigger manual check, add them here
360-
export const TRIGGER_CHECK_MANUAL = [
361-
'model_scope_model_id',
362-
'huggingface_repo_id',
363-
'huggingface_filename',
364-
'model_scope_file_path',
365-
'description',
366-
'source',
367-
'worker_selector',
368-
'backend_parameters',
369-
'local_path',
370-
'backend_version',
371-
'ollama_library_model_name',
372-
'backend',
373-
'gpu_selector',
374-
'categories',
375-
'env',
376-
'replicas',
377-
'extended_kv_cache.enabled'
378-
];
379-
380360
export const formFields = [
381361
'name',
382362
'model_scope_model_id',

src/pages/llmodels/forms/basic.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { useIntl } from '@umijs/max';
99
import { Form } from 'antd';
1010
import { useMemo } from 'react';
1111
import { sourceOptions } from '../config';
12+
import { useFormContext } from '../config/form-context';
1213
import { FormData } from '../config/types';
1314
import CatalogFrom from './catalog';
1415
import LocalPathSource from './local-path-source';
@@ -34,12 +35,19 @@ const BasicForm: React.FC<BasicFormProps> = (props) => {
3435
} = props;
3536
const intl = useIntl();
3637
const { getRuleMessage } = useAppUtils();
38+
const { onValuesChange } = useFormContext();
3739
const form = Form.useFormInstance();
3840

3941
const handleOnSourceChange = (val: string) => {
4042
onSourceChange?.(val);
4143
};
4244

45+
const handleReplicasChange = (val: number) => {
46+
if (val > 0) {
47+
onValuesChange?.({}, form.getFieldsValue());
48+
}
49+
};
50+
4351
const clusterOptions = useMemo(() => {
4452
return clusterList?.map((item) => {
4553
return {
@@ -126,6 +134,7 @@ const BasicForm: React.FC<BasicFormProps> = (props) => {
126134
]}
127135
>
128136
<SealInput.Number
137+
onChange={handleReplicasChange}
129138
style={{ width: '100%' }}
130139
label={intl.formatMessage({
131140
id: 'models.form.replicas'

src/pages/llmodels/forms/schedule-type.tsx

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ import SealSelect from '@/components/seal-form/seal-select';
55
import TooltipList from '@/components/tooltip-list';
66
import useAppUtils from '@/hooks/use-app-utils';
77
import { useIntl } from '@umijs/max';
8-
import { Form, InputNumber } from 'antd';
8+
import { Form } from 'antd';
99
import _ from 'lodash';
1010
import React from 'react';
11-
import styled from 'styled-components';
1211
import GPUCard from '../components/gpu-card';
1312
import {
1413
placementStrategyOptions,
@@ -19,10 +18,6 @@ import { backendOptionsMap } from '../config/backend-parameters';
1918
import { useFormContext } from '../config/form-context';
2019
import { FormData } from '../config/types';
2120

22-
const InputWrapper = styled.div`
23-
padding: 8px 4px;
24-
`;
25-
2621
const placementStrategyTips = [
2722
{
2823
title: 'Spread',
@@ -75,10 +70,6 @@ const ScheduleTypeForm: React.FC = () => {
7570
const form = Form.useFormInstance();
7671
const scheduleType = Form.useWatch('scheduleType', form);
7772
const workerSelector = Form.useWatch('worker_selector', form);
78-
const GPUsPerReplicas = Form.useWatch(
79-
['gpu_selector', 'gpus_per_replica'],
80-
form
81-
);
8273

8374
const handleScheduleTypeChange = (value: string) => {
8475
if (value === ScheduleValueMap.Auto) {
@@ -224,29 +215,16 @@ const ScheduleTypeForm: React.FC = () => {
224215
{ label: '1', value: 1 },
225216
{ label: '2', value: 2 },
226217
{ label: '4', value: 4 },
227-
{ label: '8', value: 8 }
218+
{ label: '8', value: 8 },
219+
{ label: '16', value: 16 },
220+
{ label: '32', value: 32 },
221+
{ label: '64', value: 64 },
222+
{ label: '128', value: 128 },
223+
{ label: '256', value: 256 }
228224
]}
229225
description={
230226
<TooltipList list={GPUsPerReplicaTips}></TooltipList>
231227
}
232-
popupRender={(originNode) => (
233-
<div>
234-
{originNode}
235-
<InputWrapper>
236-
<InputNumber
237-
min={1}
238-
step={1}
239-
style={{ width: '100%' }}
240-
defaultValue={
241-
GPUsPerReplicas === -1 ? null : GPUsPerReplicas
242-
}
243-
value={GPUsPerReplicas === -1 ? null : GPUsPerReplicas}
244-
onChange={handleGpusPerReplicasChange}
245-
onStep={handleOnStepReplicaStep}
246-
/>
247-
</InputWrapper>
248-
</div>
249-
)}
250228
/>
251229
</Form.Item>
252230
</>

0 commit comments

Comments
 (0)