fish-speech: make compile:true usable on Blackwell sm_121 by honouring the CUDA toolkit's ptxas
メンテナーはふだん 3 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 76/100
調査の方向性
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時間
- マージ済み PR(30日)
- 340
環境構築
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
mudler/LocalAI のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
mudler/LocalAI#11995 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
mudler/LocalAI#11991 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
-
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 件 ·
メンテナーはふだん 3 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
メンテナーはふだん 3 日以内に返信
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
mudler/LocalAI#12219 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
似ている issue
-
priority: low 🌱 type: enhancement 💅🏼
難易度 2/5 半日 初心者へのやさしさ 84/100
nebari-dev/llm-serving-pack#199 ·
メンテナーはふだん 3 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
area/helm kind/bug priority/backlog triage/accepted
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
lexfrei/cloudflare-tunnel-gateway-controller#889 ·
メンテナーはふだん 1 日以内に返信
-
bug difficulty: beginner documentation good first issue help wanted localization
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
wavefnd/wave-platform#140 ·
-
compiler/runtime
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信