Repository navigation
Studio: run audio.cpp on the GPU in chat-only Linux installs - #18168
Conversation
…ing its CUDA runtime
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
… failed attempt [skip ci]
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…s off (gloo-pp red since #18165) (#18184) `Repo tests (CPU, gloo-pp)` fails on main since #18165 (seen on the staging run of #18168, an audio.cpp installer change, and on #18165's own run): ``` tests/test_pp_env_gloo.py: test_pp_env_layout_and_refusals E assert ('mixture-of-experts' in ((None or ''))) tests/test_pp_native_gloo.py: test_pp2_refusals E assert 'mixture-of-experts' in ((None or '')) ``` ## Cause #18165 changed what pipeline parallel accepts: a mixture-of-experts model whose router aux loss pp does not carry between stages now splits and trains with that loss off, and is refused only once the loss is turned on (in the stage forward, and at Trainer init when TRL or the config turns it on). Its new `tests/test_pp_moe_aux_off_gloo.py` covers both halves, including `test_pp2_uncarried_moe_with_aux_on_stays_refused`. The two older refusal tests still expected every such load (OLMoE in `test_pp2_refusals`, the tiny MoE in `test_pp_env_layout_and_refusals`, both with the aux loss off by default) to be refused. The behaviour change is intended; the tests predate it. ## Fix Both assertions now expect the load to go through (`None`), with a comment pointing at the aux-on refusal coverage in `test_pp_moe_aux_off_gloo.py`. The other refusals in both tests (MLA, tied trainable embeddings, unsupported trainer options, ...) are unchanged. ## Verification - main: both tests fail as above. - this branch: the two tests plus `tests/test_pp_moe_aux_off_gloo.py`: 23 passed.
…indowsPath teardown errors) (#18191) Studio's `m-r` shard can error at teardown on whichever test fakes Windows when a WAL keeper was opened during it (seen on #18168, an audio.cpp installer change): ``` _ ERROR at teardown of test_a_user_site_install_is_not_told_to_isolate_itself __ tests/conftest.py:758: in _isolate_wal_keepers rag_db.close_wal_keeper_for(path) storage/rag_db.py:532: in close_wal_keeper_for resolved = Path(path).resolve() E pathlib._abc.UnsupportedOperation: cannot instantiate 'WindowsPath' on your system ``` ## Cause The autouse `_isolate_wal_keepers` fixture closes the WAL keepers a test opened. Its teardown runs before that test's `monkeypatch` is undone (another autouse fixture already requested `monkeypatch`, so it is torn down later). About a dozen Studio tests fake Windows with `monkeypatch.setattr(os, "name", "nt")`, `test_reset_password_command.py` through its `windows` fixture among them. If a keeper was opened during such a test (by that test or a background thread from an earlier one), the cleanup's `Path(path)` is built while `os.name` is still `"nt"`, so pathlib picks `WindowsPath` and raises on Linux. Whether it happens depends on what else runs on the worker. `rag_db.close_wal_keeper_for` and the tests are fine; the cleanup ran under the faked platform. ## Fix `_isolate_wal_keepers` swaps the real `os.name` (captured when conftest loads) back in for its cleanup and restores the test's value afterwards, so the test's own monkeypatch undo still sees what it set. New `test_conftest_teardown_real_os_name.py` fakes Windows and leaves a keeper entry for the cleanup to close, which is the CI state. ## Verification - main conftest: the new test errors at teardown with `UnsupportedOperation` (the CI error). - this branch: it passes; with `test_reset_password_command.py` and the rag/studio DB and WAL tests, 301 passed.
Chat-only (no torch) Linux installs with an NVIDIA GPU run audio.cpp (text to speech, music, dictation) on the CPU, even after #17463 fixed the same problem for llama.cpp.
Why
The Linux audio.cpp CUDA bundles link
libcudart,libcublasandlibcufftand ship none of them. A full install borrows them from torch'snvidia-*wheels. A chat-only install has no torch, so_linux_cuda_runtime_availablefails andresolve_for_requestinstalls the CPU build. Since #17463 the llama.cpp step installsnvidia-cuda-runtimeandnvidia-cublas, but nothing installs cuFFT, so audio.cpp still falls back:An existing chat-only install also never recovers:
_record_fits_requestonly looks the GPU build up again when torch's runtime appears, and a chat-only install never gets torch, so every update answers "already matches" with the CPU build.Change
resolve_for_request: when the chosen Linux CUDA bundle has no runtime and the env has no torch (Linux x86_64 only), install NVIDIA's wheels for that CUDA line first (nvidia-cuda-runtime,nvidia-cublas,nvidia-cufft, or the-cu12names), then check again. Only if they are still missing does it install the CPU build, as today. Wheels that are already installed are left alone (uv no-ops them), and nothing is installed when the runtime is already present._record_fits_request: a chat-only CPU fallback recorded before this change is looked up once more on the next update, so existing installs move to the GPU build. The new install record carriescuda_runtime_wheels_tried, so a host where the wheels cannot install (offline, a blocked mirror) keeps answering "already matches" without a lookup on later runs, as it does today.--print-assetonly resolves and never installs wheels.Hosts with torch, Windows (which downloads its own cudart archive), macOS, AMD and arm64 take exactly the same path as before. The download is the cuFFT wheel (about 157 MB plus nvjitlink) on top of what the llama.cpp step already installed, and only on chat-only Linux NVIDIA hosts.
Tests
Real run on a Colab T4 (driver 580, CUDA 13.0) with every
libcudart,libcublas,libcublasLtandlibcufftmoved off the VM so only the driver is left (cuInit= 0, 1 device). Each arm is a torch-free venv that ran the llama.cpp installer first, as a chat-only install does, then the arm's audio.cpp installer:audiocpp_server --versionlibcufft.so.12ubuntu-x64-cpu-portablebackends: cpuubuntu-x64-cuda13backends: cpu,cudanvidia/cu13/libubuntu-x64-cuda13backends: cpu,cudanvidia/cu13/libalready matches, nothing downloadedbackends: cpu,cudanvidia/cu13/libtests/studio/install/test_install_audio_cpp_prebuilt_logic.py: 244 passed (20 new). With only the functional lines reverted (helpers kept), the behaviour tests fail: wheels installed and CUDA kept, CPU fallback when the wheels fail, an old CPU record looked up once, the record marked so reruns stay offline, a kept CPU install marked after a failed attempt, and no retry for a newer release.Not covered: an offline rerun pinned to the installed release (
UNSLOTH_AUDIO_CPP_TAGor--published-release-tag) on an old chat-only CPU install now looks the release up once instead of reusing it, and fails if the lookup is unavailable. That needs an explicit pin and no network at the same time, so it is left as is.