chore: speculative_config init in updating
This commit is contained in:
@@ -70,7 +70,12 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
|
|||||||
enabled: false
|
enabled: false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
// TODO: set speculative_config
|
|
||||||
|
if (!originFormData.current.speculative_config?.enabled) {
|
||||||
|
originFormData.current.speculative_config = {
|
||||||
|
enabled: false
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import SealSelect from '@/components/seal-form/seal-select';
|
|||||||
import useAppUtils from '@/hooks/use-app-utils';
|
import useAppUtils from '@/hooks/use-app-utils';
|
||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
import { Form } from 'antd';
|
import { Form } from 'antd';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useRef, useState } from 'react';
|
||||||
import { queryDraftModelList } from '../apis';
|
import { queryDraftModelList } from '../apis';
|
||||||
import { FormData } from '../config/types';
|
import { FormData } from '../config/types';
|
||||||
|
|
||||||
@@ -28,6 +28,7 @@ const SpeculativeDecode = () => {
|
|||||||
const [draftModelList, setDraftModelList] = useState<
|
const [draftModelList, setDraftModelList] = useState<
|
||||||
Global.BaseOption<string>[]
|
Global.BaseOption<string>[]
|
||||||
>([]);
|
>([]);
|
||||||
|
const speculativeConfigRef = useRef<any>({});
|
||||||
|
|
||||||
const fetchDraftModels = async () => {
|
const fetchDraftModels = async () => {
|
||||||
const response = await queryDraftModelList({
|
const response = await queryDraftModelList({
|
||||||
@@ -42,17 +43,20 @@ const SpeculativeDecode = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleSpeculativeEnabledChange = (e: any) => {
|
const handleSpeculativeEnabledChange = (e: any) => {
|
||||||
const speculativeConfig = form.getFieldValue('speculative_config');
|
|
||||||
|
|
||||||
if (e.target.checked) {
|
if (e.target.checked) {
|
||||||
form.setFieldValue('speculative_config', {
|
form.setFieldValue('speculative_config', {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
algorithm: speculativeConfig.algorithm || AlgorithmMap.Eagle3,
|
algorithm:
|
||||||
draft_model: speculativeConfig.draft_model || '',
|
speculativeConfigRef.current.algorithm || AlgorithmMap.Eagle3,
|
||||||
num_draft_tokens: speculativeConfig.num_draft_tokens || 3,
|
draft_model: speculativeConfigRef.current.draft_model || '',
|
||||||
ngram_min_match_length: speculativeConfig.ngram_min_match_length || 1,
|
num_draft_tokens: speculativeConfigRef.current.num_draft_tokens || 3,
|
||||||
ngram_max_match_length: speculativeConfig.ngram_max_match_length || 10
|
ngram_min_match_length:
|
||||||
|
speculativeConfigRef.current.ngram_min_match_length || 1,
|
||||||
|
ngram_max_match_length:
|
||||||
|
speculativeConfigRef.current.ngram_max_match_length || 10
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
speculativeConfigRef.current = form.getFieldValue('speculative_config');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user