Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/pages/llmodels/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,6 @@ export const DO_NOT_TRIGGER_CHECK_COMPATIBILITY = [
'huggingface_repo_id',
'huggingface_filename',
'model_scope_file_path',
'replicas',
'name',
'description',
'env',
Expand Down
9 changes: 0 additions & 9 deletions src/pages/llmodels/forms/basic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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 {
Expand Down Expand Up @@ -134,7 +126,6 @@ const BasicForm: React.FC<BasicFormProps> = (props) => {
]}
>
<SealInput.Number
onChange={handleReplicasChange}
style={{ width: '100%' }}
label={intl.formatMessage({
id: 'models.form.replicas'
Expand Down
27 changes: 0 additions & 27 deletions src/pages/llmodels/forms/schedule-type.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/pages/llmodels/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down