optimized PC player

This commit is contained in:
2026-09-11 12:15:51 +08:00
parent 07261d092b
commit 4b71c6c615
5 changed files with 317 additions and 84 deletions

View File

@@ -61,6 +61,7 @@ nvidia-smi
```bash
sudo apt update
sudo apt install -y ffmpeg git curl
sudo apt install -y ninja-build
```
### 安装 uv
@@ -89,8 +90,20 @@ source .venv/bin/activate
```bash
uv pip install -e ".[torch-runtime]" --torch-backend=auto
uv pip install sglang-omni
uv pip install ninja
```
> `ninja` 是 FlashInfer JIT 编译 CUDA kernel 所需的构建工具,缺少它会在启动时
> 报 `FileNotFoundError: 'ninja'`。
>
> 必须用 `apt install ninja-build` 安装系统级 ninja(`/usr/bin/ninja`)。
> `uv pip install ninja` 只安装到虚拟环境 `.venv/bin/`,systemd 服务的 PATH
> 不包含它。如果只能用 venv 里的 ninja,在 systemd 服务的 `[Service]` 段加:
>
> ```ini
> Environment=PATH=/opt/moss-transcribe/MOSS-Transcribe-Diarize/.venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
> ```
### 下载模型
```bash
@@ -111,8 +124,6 @@ sgl-omni serve \
--model-path OpenMOSS-Team/MOSS-Transcribe-Diarize \
--host 127.0.0.1 \
--port 8001 \
--max-running-requests 4 \
--cuda-graph-max-bs 4 \
--mem-fraction-static 0.35
```
@@ -122,9 +133,7 @@ sgl-omni serve \
|------|--------|------|
| `--host` | `127.0.0.1` | 只监听本机,不要暴露公网 |
| `--port` | `8001` | 服务端口(Whisper 用 9000,避免冲突) |
| `--max-running-requests` | `4` | 最大并发请求数;显存充足可调大 |
| `--cuda-graph-max-bs` | `4` | CUDA Graph 批大小上限,与并发数一致 |
| `--mem-fraction-static` | `0.80` | 静态显存分配比例;与其他 GPU 服务共存时调低 |
| `--mem-fraction-static` | 自动 | 静态显存分配比例(作用于所有 SGLang engine stage);与其他 GPU 服务共存时调低 |
> 与 llama-server、Whisper 等其他 GPU 服务共存时,将
> `--mem-fraction-static` 设为 `0.30`–`0.40`(约 7–10 GB),避免 OOM。
@@ -352,8 +361,7 @@ curl http://127.0.0.1:8000/healthz # 确认 moss_configured 为 true
| Speaches (Whisper) | 4 GB | 停掉后释放 |
| **MOSS + llama-server** | ~16 GB / 24 GB | 安全 |
独占 GPU 时可将 `--mem-fraction-static` 调到 `0.80`(约 19 GB),
`--max-running-requests` 调到 `16`,支持更多并发。
独占 GPU 时可将 `--mem-fraction-static` 调到 `0.80`(约 19 GB),支持更多并发。
---

View File

@@ -4,7 +4,7 @@ After=network-online.target
[Service]
Type=simple
User=oraltrainer
User=lsm
WorkingDirectory=/opt/moss-transcribe
Environment=HF_ENDPOINT=https://hf-mirror.com
ExecStart=/opt/moss-transcribe/.venv/bin/vllm serve OpenMOSS-Team/MOSS-Transcribe-Diarize --host 127.0.0.1 --port 8001 --trust-remote-code

View File

@@ -4,15 +4,13 @@ After=network-online.target
[Service]
Type=simple
User=oraltrainer
User=lsm
WorkingDirectory=/opt/moss-transcribe/MOSS-Transcribe-Diarize
Environment=HF_ENDPOINT=https://hf-mirror.com
ExecStart=/opt/moss-transcribe/MOSS-Transcribe-Diarize/.venv/bin/sgl-omni serve \
--model-path OpenMOSS-Team/MOSS-Transcribe-Diarize \
--host 127.0.0.1 \
--port 8001 \
--max-running-requests 4 \
--cuda-graph-max-bs 4 \
--mem-fraction-static 0.35
Restart=on-failure
RestartSec=10