fix: do not trigger evaluation replica 0
This commit is contained in:
@@ -331,7 +331,6 @@ export const DO_NOT_TRIGGER_CHECK_COMPATIBILITY = [
|
||||
'huggingface_repo_id',
|
||||
'huggingface_filename',
|
||||
'model_scope_file_path',
|
||||
'replicas',
|
||||
'name',
|
||||
'description',
|
||||
'env',
|
||||
|
||||
@@ -9,7 +9,6 @@ import { useIntl } from '@umijs/max';
|
||||
import { Form } from 'antd';
|
||||
import { useMemo } from 'react';
|
||||
import { sourceOptions } from '../config';
|
||||
import { useFormContext } from '../config/form-context';
|
||||
import { FormData } from '../config/types';
|
||||
import CatalogFrom from './catalog';
|
||||
import LocalPathSource from './local-path-source';
|
||||
@@ -35,19 +34,12 @@ const BasicForm: React.FC<BasicFormProps> = (props) => {
|
||||
} = props;
|
||||
const intl = useIntl();
|
||||
const { getRuleMessage } = useAppUtils();
|
||||
const { onValuesChange } = useFormContext();
|
||||
const form = Form.useFormInstance();
|
||||
|
||||
const handleOnSourceChange = (val: string) => {
|
||||
onSourceChange?.(val);
|
||||
};
|
||||
|
||||
const handleReplicasChange = (val: number) => {
|
||||
if (val > 0) {
|
||||
onValuesChange?.({}, form.getFieldsValue());
|
||||
}
|
||||
};
|
||||
|
||||
const clusterOptions = useMemo(() => {
|
||||
return clusterList?.map((item) => {
|
||||
return {
|
||||
@@ -134,7 +126,6 @@ const BasicForm: React.FC<BasicFormProps> = (props) => {
|
||||
]}
|
||||
>
|
||||
<SealInput.Number
|
||||
onChange={handleReplicasChange}
|
||||
style={{ width: '100%' }}
|
||||
label={intl.formatMessage({
|
||||
id: 'models.form.replicas'
|
||||
|
||||
@@ -81,16 +81,6 @@ const ScheduleTypeForm: React.FC = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const handleGpusPerReplicasChange = (val: string | number | null) => {
|
||||
if (val === null) {
|
||||
form.setFieldValue(['gpu_selector', 'gpus_per_replica'], -1);
|
||||
} else {
|
||||
form.setFieldValue(['gpu_selector', 'gpus_per_replica'], val);
|
||||
}
|
||||
|
||||
onValuesChange?.({}, form.getFieldsValue());
|
||||
};
|
||||
|
||||
const handleGpuSelectorChange = (value: any[]) => {
|
||||
if (value.length > 0) {
|
||||
onValuesChange?.({}, form.getFieldsValue());
|
||||
@@ -99,23 +89,6 @@ const ScheduleTypeForm: React.FC = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const handleOnStepReplicaStep = (
|
||||
value: number | string | null,
|
||||
info: { offset: number | string | null; type: 'up' | 'down' }
|
||||
) => {
|
||||
let newValue = value;
|
||||
const isPowerOfTwo = (n: number) => (n & (n - 1)) === 0 && n !== 0; // check power of two
|
||||
if (!isPowerOfTwo(value as number)) {
|
||||
if (info.type === 'up') {
|
||||
newValue = Math.pow(2, Math.ceil(Math.log2(value as number)));
|
||||
} else {
|
||||
newValue = Math.pow(2, Math.floor(Math.log2(value as number)));
|
||||
}
|
||||
}
|
||||
form.setFieldValue(['gpu_selector', 'gpus_per_replica'], newValue);
|
||||
onValuesChange?.({}, form.getFieldsValue());
|
||||
};
|
||||
|
||||
const onSelectorChange = (field: string, allowEmpty?: boolean) => {
|
||||
const workerSelector = form.getFieldValue(field);
|
||||
// check if all keys have values
|
||||
|
||||
@@ -392,9 +392,11 @@ export const useCheckCompatibility = () => {
|
||||
source: string;
|
||||
}) => {
|
||||
const { allValues, source } = params;
|
||||
console.log('handleOnValuesChange', allValues);
|
||||
if (
|
||||
_.isEqual(cacheFormValuesRef.current, allValues) ||
|
||||
noLocalPathValue(allValues)
|
||||
noLocalPathValue(allValues) ||
|
||||
!allValues.replicas
|
||||
) {
|
||||
console.log('No changes detected, skipping evaluation.');
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user