fix: omit distribution and cpu_offload fields from default spec
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
LoadingOutlined,
|
||||
WarningFilled
|
||||
} from '@ant-design/icons';
|
||||
import { Button } from 'antd';
|
||||
import { isArray } from 'lodash';
|
||||
import React, { useMemo } from 'react';
|
||||
import styled from 'styled-components';
|
||||
@@ -24,13 +25,19 @@ interface CompatibilityAlertProps {
|
||||
|
||||
const DivWrapper = styled.div`
|
||||
position: relative;
|
||||
padding-inline: 12px;
|
||||
padding-inline: 8px;
|
||||
&:hover {
|
||||
.close-wrapper {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const CloseWrapper = styled.div`
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 12px;
|
||||
right: 18px;
|
||||
top: 6px;
|
||||
right: 12px;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
background-color: var(--ant-color-warning-bg);
|
||||
@@ -98,8 +105,13 @@ const CompatibilityAlert: React.FC<CompatibilityAlertProps> = (props) => {
|
||||
icon={renderIcon}
|
||||
></AlertBlockInfo>
|
||||
{showClose && !['transition', 'success'].includes(type) && (
|
||||
<CloseWrapper onClick={onClose}>
|
||||
<CloseOutlined />
|
||||
<CloseWrapper className="close-wrapper">
|
||||
<Button
|
||||
onClick={onClose}
|
||||
icon={<CloseOutlined />}
|
||||
size="small"
|
||||
type="text"
|
||||
></Button>
|
||||
</CloseWrapper>
|
||||
)}
|
||||
</DivWrapper>
|
||||
|
||||
@@ -99,6 +99,14 @@ const AddModal: FC<AddModalProps> = (props) => {
|
||||
const [isGGUF, setIsGGUF] = useState<boolean>(props.isGGUF || false);
|
||||
const modelFileRef = useRef<any>(null);
|
||||
|
||||
const getDefaultSpec = (item: any) => {
|
||||
const defaultSpec = item.evaluateResult?.default_spec || {};
|
||||
return _.omit(defaultSpec, [
|
||||
'cpu_offloading',
|
||||
'distributed_inference_across_workers'
|
||||
]);
|
||||
};
|
||||
|
||||
const getCategory = (item: any) => {
|
||||
const categories = item.evaluateResult?.default_spec?.categories || [];
|
||||
if (Array.isArray(categories)) {
|
||||
@@ -111,7 +119,7 @@ const AddModal: FC<AddModalProps> = (props) => {
|
||||
const modelInfo = onSelectModel(selectedModel, props.source);
|
||||
form.current?.setFieldsValue?.({
|
||||
file_name: item.fakeName,
|
||||
...item.evaluateResult?.default_spec,
|
||||
...getDefaultSpec(item),
|
||||
...modelInfo,
|
||||
categories: getCategory(item)
|
||||
});
|
||||
@@ -129,7 +137,7 @@ const AddModal: FC<AddModalProps> = (props) => {
|
||||
const modelInfo = onSelectModel(item, props.source);
|
||||
handleShowCompatibleAlert(item.evaluateResult);
|
||||
form.current?.setFieldsValue?.({
|
||||
...item.evaluateResult?.default_spec,
|
||||
...getDefaultSpec(item),
|
||||
...modelInfo,
|
||||
categories: getCategory(item)
|
||||
});
|
||||
|
||||
@@ -70,6 +70,11 @@ export const HuggingFaceModels = [
|
||||
type: 'tts',
|
||||
org: 'FunAudioLLM',
|
||||
name: 'CosyVoice-300M'
|
||||
},
|
||||
{
|
||||
type: 'tts',
|
||||
org: 'FunAudioLLM',
|
||||
name: 'CosyVoice2-0.5B'
|
||||
}
|
||||
];
|
||||
|
||||
@@ -104,6 +109,11 @@ export const ModelScopeModels = [
|
||||
org: 'iic',
|
||||
name: 'CosyVoice-300M-25Hz'
|
||||
},
|
||||
{
|
||||
type: 'tts',
|
||||
org: 'iic',
|
||||
name: 'CosyVoice2-0.5B'
|
||||
},
|
||||
{
|
||||
type: 'tts',
|
||||
org: 'iic',
|
||||
|
||||
Reference in New Issue
Block a user