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
+4 -4
View File
@@ -62,8 +62,8 @@ export default {
'models.search.gguf.tips': 'models.search.gguf.tips':
'GGUF 模型用 llama-box(支持 Linux, macOS 和 Windows)。', 'GGUF 模型用 llama-box(支持 Linux, macOS 和 Windows)。',
'models.search.vllm.tips': 'models.search.vllm.tips':
' 非 GGUF 的音模型用 vox-box,其它非 GGUF 的模型用 vLLM(仅支持 x86 Linux)。', ' 非 GGUF 的音模型用 vox-box,其它非 GGUF 的模型用 vLLM(仅支持 x86 Linux)。',
'models.search.voxbox.tips': '若需部署音频模型取消勾选 GGUF 复选框。', 'models.search.voxbox.tips': '若需部语音模型取消勾选 GGUF 复选框。',
'models.form.ollamalink': '在 Ollama Library 中查找', 'models.form.ollamalink': '在 Ollama Library 中查找',
'models.form.backend_parameters.llamabox.placeholder': 'models.form.backend_parameters.llamabox.placeholder':
'例如,--ctx-size=8192', '例如,--ctx-size=8192',
@@ -83,9 +83,9 @@ export default {
'models.form.backend.llamabox': 'models.form.backend.llamabox':
'用于 GGUF 格式模型,支持 Linux, macOS 和 Windows', '用于 GGUF 格式模型,支持 Linux, macOS 和 Windows',
'models.form.backend.vllm': '用于非 GGUF 格式模型,仅支持 x86 Linux', 'models.form.backend.vllm': '用于非 GGUF 格式模型,仅支持 x86 Linux',
'models.form.backend.voxbox': '用于非 GGUF 格式的音模型', 'models.form.backend.voxbox': '用于非 GGUF 格式的音模型',
'models.form.search.gguftips': 'models.form.search.gguftips':
'当 macOS 或 Windows 作 Worker 时勾选 GGUF(搜索音模型时取消勾选)', '当 macOS 或 Windows 作 Worker 时勾选 GGUF(搜索音模型时取消勾选)',
'models.form.button.addlabel': '添加标签', 'models.form.button.addlabel': '添加标签',
'models.filter.category': '按类别筛选', 'models.filter.category': '按类别筛选',
'models.list.more.logs': '查看更多', 'models.list.more.logs': '查看更多',
@@ -21,8 +21,10 @@ import {
ModelScopeSortType, ModelScopeSortType,
ModelSortType, ModelSortType,
ModelscopeTaskMap, ModelscopeTaskMap,
backendOptionsMap,
modelSourceMap modelSourceMap
} from '../config'; } from '../config';
import { identifyModelTask } from '../config/audio-catalog';
import SearchStyle from '../style/search-result.less'; import SearchStyle from '../style/search-result.less';
import SearchInput from './search-input'; import SearchInput from './search-input';
import SearchResult from './search-result'; import SearchResult from './search-result';
@@ -204,7 +206,9 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
} }
try { try {
const repoList = list.map((item) => { const repoList = list.map((item) => {
const isAuido = identifyModelTask(modelSource, item.name);
return { return {
...(isAuido ? { backend: backendOptionsMap.voxBox } : {}),
source: modelSource, source: modelSource,
...(modelSource === modelSourceMap.huggingface_value ...(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) => { export const identifyModelTask = (source: string, modelName: string) => {
let data = null; let data = null;
if (source === modelSourceMap.huggingface_value) { if (source === modelSourceMap.huggingface_value) {
data = HuggingFaceModels.find( data = HuggingFaceModels.find((item) => checkModelName(modelName, item));
(item) =>
`${item.org}/${item.name}`.indexOf(modelName) > -1 ||
modelName?.indexOf(`${item.org}/${item.name}`) > -1
);
} }
if (source === modelSourceMap.modelscope_value) { if (source === modelSourceMap.modelscope_value) {
data = ModelScopeModels.find( data = ModelScopeModels.find((item) => checkModelName(modelName, item));
(item) =>
`${item.org}/${item.name}`.indexOf(modelName) > -1 ||
modelName?.indexOf(`${item.org}/${item.name}`) > -1
);
} }
if (data) { if (data) {
return modelTaskMap.audio; return modelTaskMap.audio;
@@ -11,11 +11,7 @@ import useBodyScroll from '@/hooks/use-body-scroll';
import useTableFetch from '@/hooks/use-table-fetch'; import useTableFetch from '@/hooks/use-table-fetch';
import { createModel } from '@/pages/llmodels/apis'; import { createModel } from '@/pages/llmodels/apis';
import DeployModal from '@/pages/llmodels/components/deploy-modal'; import DeployModal from '@/pages/llmodels/components/deploy-modal';
import { import { backendOptionsMap, modelSourceMap } from '@/pages/llmodels/config';
backendOptionsMap,
modelSourceMap,
setSourceRepoConfigValue
} from '@/pages/llmodels/config';
import { identifyModelTask } from '@/pages/llmodels/config/audio-catalog'; import { identifyModelTask } from '@/pages/llmodels/config/audio-catalog';
import { import {
modalConfig, modalConfig,
@@ -298,8 +294,6 @@ const ModelFiles = () => {
const targetWorker = _.find(workersList, { value: record.worker_id }) const targetWorker = _.find(workersList, { value: record.worker_id })
?.labels?.['worker-name']; ?.labels?.['worker-name'];
const result = setSourceRepoConfigValue(record.source, record);
return { return {
source: modelSourceMap.local_path_value, source: modelSourceMap.local_path_value,
local_path: record.resolved_paths?.[0], local_path: record.resolved_paths?.[0],
+16 -17
View File
@@ -1,3 +1,5 @@
import _ from 'lodash';
export const isNotEmptyValue = (value: any) => { export const isNotEmptyValue = (value: any) => {
if (Array.isArray(value)) { if (Array.isArray(value)) {
return value.length > 0; return value.length > 0;
@@ -20,25 +22,22 @@ export const handleBatchRequest = async (
}; };
export const convertFileSize = ( export const convertFileSize = (
sizeInBytes: number | undefined, sizeInBytes?: number,
prec?: number, prec = 1,
allowEmpty = false allowEmpty = false
) => { ): string => {
const precision = prec ?? 1; if (!sizeInBytes) return allowEmpty ? '' : '0';
if (!sizeInBytes) {
return allowEmpty ? '' : '0'; const units = ['B', 'KiB', 'MiB', 'GiB', 'TiB'];
} let size = sizeInBytes;
if (sizeInBytes < 1024) { let unitIndex = 0;
return `${sizeInBytes.toFixed(precision)} B`;
} else if (sizeInBytes < 1024 * 1024) { while (size >= 1024 && unitIndex < units.length - 1) {
return `${(sizeInBytes / 1024).toFixed(precision)} KiB`; size /= 1024;
} else if (sizeInBytes < 1024 * 1024 * 1024) { unitIndex++;
return `${(sizeInBytes / (1024 * 1024)).toFixed(precision)} MiB`;
} else if (sizeInBytes < 1024 * 1024 * 1024 * 1024) {
return `${(sizeInBytes / (1024 * 1024 * 1024)).toFixed(precision)} GiB`;
} else {
return `${(sizeInBytes / (1024 * 1024 * 1024 * 1024)).toFixed(precision)} TiB`;
} }
return `${_.round(size, prec)} ${units[unitIndex]}`;
}; };
export const platformCall = () => { export const platformCall = () => {