fish-speech: make compile:true usable on Blackwell sm_121 by honouring the CUDA toolkit's ptxas
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 backend/python/fish-speech/run.sh 中 PYTHONPATH export 附近开始,检查 backend 进程如何接收环境变量。验证现有的 CUDA toolkit 路径,并保留调用方提供的任何 TRITON_PTXAS_PATH。重新构建或运行 arm64 CUDA 13 backend,使用 compile:true 重新加载 fish-speech,并确认语音请求在 sm_121 上成功。
由索引模型根据 Issue 内容生成。
描述
Is your feature request related to a problem? Please describe.
The fish-speech backend exposes compile as a model option, which turns on
torch.compile inside launch_thread_safe_queue:
compile_model = self.options.get("compile", False)
llama_queue = launch_thread_safe_queue(
checkpoint_path=model_path, device=device, precision=precision, compile=compile_model
)
On Blackwell sm_121 hardware (NVIDIA DGX Spark, GB10) this option cannot be used
at all. Enabling it makes every TTS request fail with HTTP 500:
error during TTS: TTS inference error: PTXAS error: Internal Triton PTX codegen error
`ptxas` stderr:
ptxas fatal : Value 'sm_121a' is not defined for option 'gpu-name'
Repro command: /backends/cuda13-nvidia-l4t-arm64-fish-speech/venv/lib/python3.10/site-packages/triton/backends/nvidia/bin/ptxas -lineinfo -v --gpu-name=sm_121a /tmp/tmphozi1i5i.ptx -o /tmp/tmphozi1i5i.ptx.o
The ptxas that ships inside the Triton wheel predates sm_121, while the CUDA
13.0 toolkit already present in the same image understands the target natively.
This is a known Triton/PyTorch packaging gap rather than a LocalAI bug, but
LocalAI is where it surfaces, and LocalAI is where it can be worked around
cheaply. See triton-lang/triton#10331 and pytorch/pytorch#163801.
Two things make this worse than a plain unsupported-option error:
- The failure is deferred. The model loads successfully and reports healthy;
/systemlists it underloaded_models. The 500 only appears on the first
inference, becausetorch.compilewarms up lazily. A user who enables the
option and restarts sees a working server that 500s on every request. - The cost of leaving it off is large. On this hardware
compile:trueis
not a marginal tuning knob — it is worth 5–7x. Autoregressive decode at batch
size 1 is bandwidth- and kernel-launch-bound on GB10's unified LPDDR5X
(~273 GB/s), which is exactly the case CUDA graphs address.
Measured on a DGX Spark against fish-speech-s2-pro over the HTTP API, same
input text, warm model:
| workload | compile off |
compile on |
speedup |
|---|---|---|---|
| short sentence (1.5 s audio) | 29.6 s | 5.7 s | 5.2x |
| chunked narration (22.0 s audio) | 397.3 s | 57.4 s | 6.9x |
Expressed as a realtime factor, that is 18.7x slower than realtime dropping to
3.8x for short input and 17.8x dropping to 2.6x for long input. GPU utilization
sat at 96% in both cases, so the slow path was never a CPU fallback — it was
kernel-launch overhead that CUDA graphs remove.
Describe the solution you'd like
Have backend/python/fish-speech/run.sh point Triton at the toolkit ptxas when
one is available, in the same place the PYTHONPATH export goes:
if [ -z "${TRITON_PTXAS_PATH:-}" ] && [ -x /usr/local/cuda/bin/ptxas ]; then
export TRITON_PTXAS_PATH=/usr/local/cuda/bin/ptxas
fi
Properties that make this cheap:
- It is a no-op when the CUDA toolkit is absent, so CPU and non-CUDA images are
unaffected. - It is a no-op when the caller already set
TRITON_PTXAS_PATH. compilestill defaults toFalse, so nothing changes for users who don't opt in.- It needs no new dependency and no image rebuild beyond the shell script.
Two optional improvements, either of which would have saved the debugging time
here — happy to split them into separate issues if preferred:
- Fail at load, not at first inference. When
compileis requested, either
run a trivial warmup compile insideLoadModelor catch the PTXAS error and
fall back to eager with a warning, rather than 500-ing every request. - Document the option.
compileisn't mentioned in the TTS docs, so its
existence and its cost/benefit on bandwidth-limited hardware are not
discoverable.
The same TRITON_PTXAS_PATH treatment likely applies to every Python backend
that can reach torch.compile on this hardware, not just fish-speech.
Describe alternatives you've considered
- Leave
compileoff. Works, but gives up 5–7x on hardware LocalAI already
ships a dedicatednvidia-l4t-arm64-cuda-13image for. - Patch the running container. What I did to gather the numbers above. It
does not survive a redeploy, so it has to be re-applied from a post-deployment
hook alongside the three workarounds from my earlier arm64 report. Fragile,
and the failure mode when it silently doesn't run is a fully broken TTS
endpoint rather than a slow one. - Ship a newer Triton in the backend image. Fixes the root cause rather than
routing around it, but it is a much heavier change with its own compatibility
risk against the pinnedtorch 2.9.1+cu130, and it has to be redone every
time a new architecture lands. - Set
TRITON_PTXAS_PATHfrom the model YAML. Model options are read after
the process has started, so this cannot reliably affect Triton's toolchain
discovery. It belongs inrun.sh.
Additional context
Environment:
- NVIDIA DGX Spark (GB10, compute capability 12.1 / sm_121), aarch64, Docker
localai/localai:latest-nvidia-l4t-arm64-cuda-13, backend
cuda13-nvidia-l4t-arm64-fish-speech- Driver 580.95.05, CUDA 13.0; backend venv Python 3.10.18,
torch 2.9.1+cu130 - Model
fish-speech-s2-pro, voice cloning via a Voice Library profile
Reproduce:
- Bring up the image on an sm_121 host with the workarounds from my earlier
arm64 report applied, so the backend loads on GPU - Add to
/models/fish-speech-s2-pro.yaml:options: - compile:true - Restart, or
POST /backend/shutdownwith{"model":"fish-speech-s2-pro"}—
editing the YAML alone is not enough, sincecompileis only read at load - Issue any
/v1/audio/speechrequest → HTTP 500 with the PTXAS error above - Export
TRITON_PTXAS_PATH=/usr/local/cuda/bin/ptxasin the backend's
run.sh, reload the model, and the same request succeeds
Note for anyone reproducing the timings: the first inference after a restart
costs ~120 s of torch.compile warmup and is easy to mistake for a hang.
Requests are also serialized by the single launch_thread_safe_queue worker —
two concurrent requests took 52.7 s against 29.6 s for one — so client-side
parallelism does not hide the latency.
Caveat: everything above was verified by patching a running container and
driving the HTTP API. I have not rebuilt the arm64 CUDA 13 backend image, so the
proposed run.sh change is unverified at image-build time. I have GB10 hardware
available and am happy to test any build, or to open the PR for the run.sh
change if that's useful.
Related: my earlier report on this backend covering the PYTHONPATH, CPU torch
wheel and partial cuDNN bundle defects on the same platform. #11344
- 主要语言
- Go
- 星标
- 49.2k
- 派生
- 4.5k
- 平均合并
- 1 天 7 小时
- 30 天内合并 PR
- 357
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
mudler/LocalAI 的其他 Issue
-
bug unconfirmed
难度 2/5 1-3 小时 新手友好度 78/100
mudler/LocalAI#12337 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
mudler/LocalAI#11995 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
mudler/LocalAI#11991 · 1 条评论 ·
维护者通常 1 天内回复
-
bug unconfirmed
难度 4/5 3-5 天 新手友好度 70/100
mudler/LocalAI#12331 · 1 条评论 ·
维护者通常 1 天内回复
-
feat: add automatic MCP transport selection for 2024-11-05 / 2025-03-26 / 2025-06-18 vs 2025-11-25未关闭enhancement
难度 3/5 1-2 天 新手友好度 65/100
mudler/LocalAI#12262 · 2 条评论 ·
维护者通常 1 天内回复
相似的 Issue
-
bug
难度 1/5 1 小时以内 新手友好度 92/100
open-telemetry/opentelemetry-go-compile-instrumentation#1417 ·
维护者通常 2 天内回复
-
agent-research-finding agent-research-recommend chore ready-for-agent
难度 2/5 1-3 小时 新手友好度 85/100
jordansmall/spindrift#4068 · 1 条评论 ·
维护者通常 1 天内回复
-
Type/Task
难度 2/5 1-3 小时 新手友好度 74/100
OpenNSW/nsw-srilanka#537 ·
维护者通常 1 天内回复
-
security
难度 2/5 1-2 天 新手友好度 62/100
-
难度 2/5 1-3 小时 新手友好度 90/100
维护者通常 1 天内回复