Skip to content

Commit f6a3497

Browse files
committed
fix: do not trigger evaluation replica 0
1 parent d7ef647 commit f6a3497

File tree

4 files changed

+3
-38
lines changed

4 files changed

+3
-38
lines changed

src/pages/llmodels/config/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,6 @@ export const DO_NOT_TRIGGER_CHECK_COMPATIBILITY = [
331331
'huggingface_repo_id',
332332
'huggingface_filename',
333333
'model_scope_file_path',
334-
'replicas',
335334
'name',
336335
'description',
337336
'env',

src/pages/llmodels/forms/basic.tsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ 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';
1312
import { FormData } from '../config/types';
1413
import CatalogFrom from './catalog';
1514
import LocalPathSource from './local-path-source';
@@ -35,19 +34,12 @@ const BasicForm: React.FC<BasicFormProps> = (props) => {
3534
} = props;
3635
const intl = useIntl();
3736
const { getRuleMessage } = useAppUtils();
38-
const { onValuesChange } = useFormContext();
3937
const form = Form.useFormInstance();
4038

4139
const handleOnSourceChange = (val: string) => {
4240
onSourceChange?.(val);
4341
};
4442

45-
const handleReplicasChange = (val: number) => {
46-
if (val > 0) {
47-
onValuesChange?.({}, form.getFieldsValue());
48-
}
49-
};
50-
5143
const clusterOptions = useMemo(() => {
5244
return clusterList?.map((item) => {
5345
return {
@@ -134,7 +126,6 @@ const BasicForm: React.FC<BasicFormProps> = (props) => {
134126
]}
135127
>
136128
<SealInput.Number
137-
onChange={handleReplicasChange}
138129
style={{ width: '100%' }}
139130
label={intl.formatMessage({
140131
id: 'models.form.replicas'

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

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,6 @@ const ScheduleTypeForm: React.FC = () => {
8181
}
8282
};
8383

84-
const handleGpusPerReplicasChange = (val: string | number | null) => {
85-
if (val === null) {
86-
form.setFieldValue(['gpu_selector', 'gpus_per_replica'], -1);
87-
} else {
88-
form.setFieldValue(['gpu_selector', 'gpus_per_replica'], val);
89-
}
90-
91-
onValuesChange?.({}, form.getFieldsValue());
92-
};
93-
9484
const handleGpuSelectorChange = (value: any[]) => {
9585
if (value.length > 0) {
9686
onValuesChange?.({}, form.getFieldsValue());
@@ -99,23 +89,6 @@ const ScheduleTypeForm: React.FC = () => {
9989
}
10090
};
10191

102-
const handleOnStepReplicaStep = (
103-
value: number | string | null,
104-
info: { offset: number | string | null; type: 'up' | 'down' }
105-
) => {
106-
let newValue = value;
107-
const isPowerOfTwo = (n: number) => (n & (n - 1)) === 0 && n !== 0; // check power of two
108-
if (!isPowerOfTwo(value as number)) {
109-
if (info.type === 'up') {
110-
newValue = Math.pow(2, Math.ceil(Math.log2(value as number)));
111-
} else {
112-
newValue = Math.pow(2, Math.floor(Math.log2(value as number)));
113-
}
114-
}
115-
form.setFieldValue(['gpu_selector', 'gpus_per_replica'], newValue);
116-
onValuesChange?.({}, form.getFieldsValue());
117-
};
118-
11992
const onSelectorChange = (field: string, allowEmpty?: boolean) => {
12093
const workerSelector = form.getFieldValue(field);
12194
// check if all keys have values

src/pages/llmodels/hooks/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,9 +392,11 @@ export const useCheckCompatibility = () => {
392392
source: string;
393393
}) => {
394394
const { allValues, source } = params;
395+
console.log('handleOnValuesChange', allValues);
395396
if (
396397
_.isEqual(cacheFormValuesRef.current, allValues) ||
397-
noLocalPathValue(allValues)
398+
noLocalPathValue(allValues) ||
399+
!allValues.replicas
398400
) {
399401
console.log('No changes detected, skipping evaluation.');
400402
return;

0 commit comments

Comments
 (0)