From ade1db5215bef302c423be6b1cbb4bcd4f942d6b Mon Sep 17 00:00:00 2001 From: jialin Date: Tue, 8 Apr 2025 20:56:25 +0800 Subject: [PATCH] fix: omit distribution and cpu_offload fields from default spec --- src/components/alert-info/block.less | 3 +- src/components/alert-info/block.tsx | 2 +- src/locales/en-US/resources.ts | 2 +- src/locales/ja-JP/resources.ts | 5 ++- src/locales/ru-RU/resources.ts | 4 +- src/locales/zh-CN/resources.ts | 2 +- .../llmodels/components/compatible-alert.tsx | 22 ++++++++--- .../llmodels/components/deploy-modal.tsx | 12 +++++- src/pages/llmodels/config/audio-catalog.ts | 10 +++++ src/pages/resources/config/index.ts | 39 ++++++++++++++++++- 10 files changed, 85 insertions(+), 16 deletions(-) diff --git a/src/components/alert-info/block.less b/src/components/alert-info/block.less index 482c7374..098b717b 100644 --- a/src/components/alert-info/block.less +++ b/src/components/alert-info/block.less @@ -1,5 +1,6 @@ .alert-info-block { - padding: 6px 10px; + padding-block: 6px; + padding-inline: 10px 16px; position: relative; padding-left: 32px; text-align: left; diff --git a/src/components/alert-info/block.tsx b/src/components/alert-info/block.tsx index 84e2b3f4..32c3f2e9 100644 --- a/src/components/alert-info/block.tsx +++ b/src/components/alert-info/block.tsx @@ -65,7 +65,7 @@ const AlertInfo: React.FC = (props) => { {title && ( {title} )} - + ASCEND_VISIBLE_DEVICES to the required GPU indices. For GPU0 to GPU3, use ASCEND_VISIBLE_DEVICES=0,1,2,3 or ASCEND_VISIBLE_DEVICES=0-3.`, + 'resources.worker.cann.tips': `Set --device /dev/davinci{index} according to the required NPU index. For example, to mount NPU0 and NPU1, add --device /dev/davinci0 --device /dev/davinci1.`, 'resources.modelfiles.form.path': 'Storage Path', 'resources.modelfiles.modelfile': 'Model Files', 'resources.modelfiles.download': 'Add Model File', diff --git a/src/locales/ja-JP/resources.ts b/src/locales/ja-JP/resources.ts index 65dd440e..c52abfd4 100644 --- a/src/locales/ja-JP/resources.ts +++ b/src/locales/ja-JP/resources.ts @@ -57,7 +57,7 @@ export default { 'ラベルを選択してコマンドを生成し、コピーを使用してコマンドをコピーします。', 'resources.worker.script.install': 'スクリプトインストール', 'resources.worker.container.install': 'コンテナインストール(Linuxのみ)', - 'resources.worker.cann.tips': `ASCEND_VISIBLE_DEVICES を必要なGPUインデックスに設定します。GPU0からGPU3の場合、ASCEND_VISIBLE_DEVICES=0,1,2,3 または ASCEND_VISIBLE_DEVICES=0-3 を使用します。`, + 'resources.worker.cann.tips': `Set --device /dev/davinci{index} according to the required NPU index. For example, to mount NPU0 and NPU1, add --device /dev/davinci0 --device /dev/davinci1.`, 'resources.modelfiles.form.path': 'Storage Path', 'resources.modelfiles.modelfile': 'Model Files', 'resources.modelfiles.download': 'Add Model File', @@ -93,5 +93,6 @@ export default { // 14. 'resources.worker.add.step2.tips', // 15. 'resources.modelfiles.copy.tips', // 16. 'resources.filter.path', -// 17. 'resources.form.workerSelector.description +// 17. 'resources.form.workerSelector.description, +// 18. 'resources.worker.cann.tips', // ========== End of To-Do List ========== diff --git a/src/locales/ru-RU/resources.ts b/src/locales/ru-RU/resources.ts index 5deee636..e2eda7fc 100644 --- a/src/locales/ru-RU/resources.ts +++ b/src/locales/ru-RU/resources.ts @@ -56,7 +56,7 @@ export default { 'Выберите метку для генерации команды и скопируйте её.', 'resources.worker.script.install': 'Установка скриптом', 'resources.worker.container.install': 'Установка контейнером (только Linux)', - 'resources.worker.cann.tips': `Укажите индексы GPU через ASCEND_VISIBLE_DEVICES=0,1,2,3 или ASCEND_VISIBLE_DEVICES=0-3.`, + 'resources.worker.cann.tips': `Set --device /dev/davinci{index} according to the required NPU index. For example, to mount NPU0 and NPU1, add --device /dev/davinci0 --device /dev/davinci1.`, 'resources.modelfiles.form.path': 'Путь хранения', 'resources.modelfiles.modelfile': 'Файлы моделей', 'resources.modelfiles.download': 'Добавить файл модели', @@ -75,5 +75,5 @@ export default { }; // ========== To-Do: Translate Keys (Remove After Translation) ========== - +// 1. 'resources.worker.cann.tips' // ========== End of To-Do List ========== diff --git a/src/locales/zh-CN/resources.ts b/src/locales/zh-CN/resources.ts index 8588abf3..73219b43 100644 --- a/src/locales/zh-CN/resources.ts +++ b/src/locales/zh-CN/resources.ts @@ -55,7 +55,7 @@ export default { 'resources.worker.script.install': '脚本安装', 'resources.worker.container.install': '容器安装(仅支持 Linux)', 'resources.worker.cann.tips': - '按需要挂载的 GPU index 设置 ASCEND_VISIBLE_DEVICES,如需挂载 GPU0 - GPU3,则设为 ASCEND_VISIBLE_DEVICES=0,1,2,3ASCEND_VISIBLE_DEVICES=0-3', + '按需要挂载的 NPU index 设置 --device /dev/davinci{index},如需挂载 NPU0 - NPU1,则添加 --device /dev/davinci0 --device /dev/davinci1', 'resources.modelfiles.form.path': '存储路径', 'resources.modelfiles.modelfile': '模型文件', 'resources.modelfiles.download': '添加模型文件', diff --git a/src/pages/llmodels/components/compatible-alert.tsx b/src/pages/llmodels/components/compatible-alert.tsx index d01166ea..7bf79882 100644 --- a/src/pages/llmodels/components/compatible-alert.tsx +++ b/src/pages/llmodels/components/compatible-alert.tsx @@ -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 = (props) => { icon={renderIcon} > {showClose && !['transition', 'success'].includes(type) && ( - - + + )} diff --git a/src/pages/llmodels/components/deploy-modal.tsx b/src/pages/llmodels/components/deploy-modal.tsx index 4869bc8e..6f7cc6e6 100644 --- a/src/pages/llmodels/components/deploy-modal.tsx +++ b/src/pages/llmodels/components/deploy-modal.tsx @@ -99,6 +99,14 @@ const AddModal: FC = (props) => { const [isGGUF, setIsGGUF] = useState(props.isGGUF || false); const modelFileRef = useRef(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 = (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 = (props) => { const modelInfo = onSelectModel(item, props.source); handleShowCompatibleAlert(item.evaluateResult); form.current?.setFieldsValue?.({ - ...item.evaluateResult?.default_spec, + ...getDefaultSpec(item), ...modelInfo, categories: getCategory(item) }); diff --git a/src/pages/llmodels/config/audio-catalog.ts b/src/pages/llmodels/config/audio-catalog.ts index b3ba38e1..a5b1660e 100644 --- a/src/pages/llmodels/config/audio-catalog.ts +++ b/src/pages/llmodels/config/audio-catalog.ts @@ -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', diff --git a/src/pages/resources/config/index.ts b/src/pages/resources/config/index.ts index 23966264..286334ad 100644 --- a/src/pages/resources/config/index.ts +++ b/src/pages/resources/config/index.ts @@ -62,7 +62,16 @@ export const addWorkerGuide: Record = { }) { return `docker run -d --name gpustack \ --restart=unless-stopped \ - -e ASCEND_VISIBLE_DEVICES=0,1 \ + --device /dev/davinci0 \ + --device /dev/davinci1 \ + --device /dev/davinci_manager \ + --device /dev/devmm_svm \ + --device /dev/hisi_hdc \ + -v /usr/local/dcmi:/usr/local/dcmi \ + -v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \ + -v /usr/local/Ascend/driver/lib64/:/usr/local/Ascend/driver/lib64/ \ + -v /usr/local/Ascend/driver/version.info:/usr/local/Ascend/driver/version.info \ + -v /etc/ascend_install.info:/etc/ascend_install.info \ --network=host \ --ipc=host \ -v gpustack-data:/var/lib/gpustack \ @@ -70,6 +79,34 @@ export const addWorkerGuide: Record = { --server-url ${params.server} --token ${params.token} --worker-ip ${params.workerip}`; } }, + npu310p: { + getToken: + 'Get-Content -Path (Join-Path -Path $env:APPDATA -ChildPath "gpustack\\token") -Raw', + registerWorker(params: { + server: string; + tag: string; + token: string; + workerip: string; + }) { + return `docker run -d --name gpustack \ + --restart=unless-stopped \ + --device /dev/davinci0 \ + --device /dev/davinci1 \ + --device /dev/davinci_manager \ + --device /dev/devmm_svm \ + --device /dev/hisi_hdc \ + -v /usr/local/dcmi:/usr/local/dcmi \ + -v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \ + -v /usr/local/Ascend/driver/lib64/:/usr/local/Ascend/driver/lib64/ \ + -v /usr/local/Ascend/driver/version.info:/usr/local/Ascend/driver/version.info \ + -v /etc/ascend_install.info:/etc/ascend_install.info \ + --network=host \ + --ipc=host \ + -v gpustack-data:/var/lib/gpustack \ + gpustack/gpustack:${params.tag}-310p \ + --server-url ${params.server} --token ${params.token} --worker-ip ${params.workerip}`; + } + }, musa: { getToken: 'Get-Content -Path (Join-Path -Path $env:APPDATA -ChildPath "gpustack\\token") -Raw',