fix: add backend field in evaluation payload

This commit is contained in:
jialin
2025-04-08 14:37:31 +08:00
parent f6bc183972
commit c09503aad8
5 changed files with 41 additions and 38 deletions
@@ -21,8 +21,10 @@ import {
ModelScopeSortType,
ModelSortType,
ModelscopeTaskMap,
backendOptionsMap,
modelSourceMap
} from '../config';
import { identifyModelTask } from '../config/audio-catalog';
import SearchStyle from '../style/search-result.less';
import SearchInput from './search-input';
import SearchResult from './search-result';
@@ -204,7 +206,9 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
}
try {
const repoList = list.map((item) => {
const isAuido = identifyModelTask(modelSource, item.name);
return {
...(isAuido ? { backend: backendOptionsMap.voxBox } : {}),
source: modelSource,
...(modelSource === modelSourceMap.huggingface_value
? {
+16 -10
View File
@@ -181,21 +181,27 @@ export const ModelScopeModels = [
}
];
const checkModelName = (
modelName: string,
item: { type: string; org: string; name: string }
) => {
let sourceName = `${item.org}/${item.name}`;
if (item.name === '*') {
sourceName = `${item.org}`;
}
return (
`${sourceName}`.indexOf(modelName) > -1 ||
modelName?.indexOf(`${sourceName}`) > -1
);
};
export const identifyModelTask = (source: string, modelName: string) => {
let data = null;
if (source === modelSourceMap.huggingface_value) {
data = HuggingFaceModels.find(
(item) =>
`${item.org}/${item.name}`.indexOf(modelName) > -1 ||
modelName?.indexOf(`${item.org}/${item.name}`) > -1
);
data = HuggingFaceModels.find((item) => checkModelName(modelName, item));
}
if (source === modelSourceMap.modelscope_value) {
data = ModelScopeModels.find(
(item) =>
`${item.org}/${item.name}`.indexOf(modelName) > -1 ||
modelName?.indexOf(`${item.org}/${item.name}`) > -1
);
data = ModelScopeModels.find((item) => checkModelName(modelName, item));
}
if (data) {
return modelTaskMap.audio;
@@ -11,11 +11,7 @@ import useBodyScroll from '@/hooks/use-body-scroll';
import useTableFetch from '@/hooks/use-table-fetch';
import { createModel } from '@/pages/llmodels/apis';
import DeployModal from '@/pages/llmodels/components/deploy-modal';
import {
backendOptionsMap,
modelSourceMap,
setSourceRepoConfigValue
} from '@/pages/llmodels/config';
import { backendOptionsMap, modelSourceMap } from '@/pages/llmodels/config';
import { identifyModelTask } from '@/pages/llmodels/config/audio-catalog';
import {
modalConfig,
@@ -298,8 +294,6 @@ const ModelFiles = () => {
const targetWorker = _.find(workersList, { value: record.worker_id })
?.labels?.['worker-name'];
const result = setSourceRepoConfigValue(record.source, record);
return {
source: modelSourceMap.local_path_value,
local_path: record.resolved_paths?.[0],