Repository navigation
Studio: switch llama.cpp backends from the UI - #8520
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3029526d67
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 973a25c600
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6b7cc1ec10
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dd638d970d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ecf20008eb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b2873432ef
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cd3b88da29
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1dc78b1ad9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d3af574434
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e190343fea
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 91268c31a7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! 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". |
|
cuda + rocm backend dynamic loading ??? (-DGGML_BACKEND_DL=ON) |
|
Before/after evidence for this PR, from two isolated Studio installs built with Settings > System, at the section boundary. Before, "GPU devices" runs straight into "Model memory". After, the new section sits between them, with the trigger reading The picker open. Before there is no control to open. After it lists exactly four rows and ROCm is absent, which the API confirms is the availability filter rather than a rendering accident.
{
"supported": true, "reason": null, "env_backend": null,
"backend": "cuda", "backend_request": "auto", "selection_applied": true,
"installed_tag": "b10360-mix-87da1a2",
"options": [
{"backend": "auto", "available": true, "resolved_backend": "cuda", "download_size_bytes": 229262760},
{"backend": "cpu", "available": true, "resolved_backend": "cpu", "download_size_bytes": 16730497},
{"backend": "cuda", "available": true, "resolved_backend": "cuda", "download_size_bytes": 229262760},
{"backend": "rocm", "available": false, "unavailable_reason": "unavailable", "resolved_backend": null},
{"backend": "vulkan", "available": true, "resolved_backend": "vulkan", "download_size_bytes": 32738678}
]
}One quieter change worth recording, since no screenshot of the new section would show it: the pre-existing Test runs on the head, on this box: the eight llama backend suites under |
The Source lint job fails on studio/install_llama_prebuilt.py: scripts/verify_import_hoist.py reports INSTALL_KIND_BACKENDS and marker_backend as hoisted but unused. marker_backend is genuinely dead here, so it goes. INSTALL_KIND_BACKENDS is not: the installer is meant to share one vocabulary with the marker readers, and two tests assert that through this module. Give it a real use instead of a bare re-export by deriving VULKAN_INSTALL_KINDS from the map rather than spelling the same two names out again, which also removes a mirrored definition of the kind this file warns about elsewhere.
read_install_marker returns whatever json.loads produced, so a marker holding [] or 123 reaches callers as something without .get. Every caller assumes a mapping, and the new backend picker adds one more: get_backend_status calls marker_backend(marker) and raises AttributeError, so GET /api/llama/backend answers 500 and Settings > System shows a load error for what is only a corrupt file. This is not new on this branch (get_update_status raises the same way on main), but the picker makes it reachable from a page users open. Guard it where the file is read, so the update planner, the picker and crash recovery all degrade to the source-build path together, exactly as they already do for unparseable JSON.
The Select is disabled whenever env_backend is set, but Apply is gated only on dirtiness, and the two are computed independently. An automatic install whose detection has since drifted reports selection_applied false, so the row is dirty while the Select is disabled and Apply becomes the only live control. POST /api/llama/backend then refuses it with environment_override, which is correct, but the button should not have offered it. Also fills in the status shapes the payload tests did not reach: every unsupported reason, a macOS install reporting metal, and the terminal job states.
The Windows half of the fail-closed change was asserted by comparing source strings, which cannot catch a branch that reads the same and behaves differently. Extract the routing block the way the bash harness already does, run it under pwsh, and require the same decision from both: identical exit code, and identical answer on whether a source build was queued. Covers exit codes 0/1/2/3/4/5/137 against each explicit backend and both install states, 70 pairs, and pins the two branches the picker depends on: exit 5 fails closed everywhere, exit 2 stays the one automatic path allowed to fall back to a compile. Skipped where pwsh is absent, like the other PowerShell tests here.
|
I pushed four commits to this branch after simulating the compatibility surface. Summary of what I ran and what it showed. The one thing that was actually red
The other red jobs are not this PR. The Python matrices fail on Host matrixDrove
Worth noting three of these specifically. The mixed NVIDIA plus AMD host still offers ROCm, so the re-probe in Note the caveat on WSL: Old installsRan every marker shape a pre-existing install can have through the readers. All 22 behave, including
setup.sh against setup.ps1The PowerShell half of the exit routing was asserted by comparing source strings, which cannot catch a branch that reads the same and behaves differently. I added a harness that extracts the block and runs it under That also measures the change this PR is really making. On the merge base, exit 2 with a concrete BrowsersDrove the picker in Chromium, Firefox and WebKit against one Studio built from this branch. All three read One small UI fixThe Select is disabled whenever Test runs
Nothing here changes the feature's behaviour. Happy to drop any of the four if you would rather keep them separate. |
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a8b4f599f4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| !acceptedStartedAt || | ||
| job.startedAt !== acceptedStartedAt || | ||
| job.operation !== "switch" |
There was a problem hiding this comment.
Use a unique identifier for switch jobs
When two switch operations are started within the same wall-clock second, this ownership check can mistake the second job for the first because the backend populates started_at with _flow.utcnow(), whose format has only second precision. This is reachable with fast reuse-only switches across two tabs: a tab still polling the first switch can adopt the second switch and report its success or failure as the outcome of the first request. Return a unique job ID or a sufficiently precise timestamp and compare that instead.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
The precision point is correct: update_flow.utcnow() is time.strftime("%Y-%m-%dT%H:%M:%SZ"), so started_at carries whole seconds and is doing duty as a job identity. But I do not think the window is reachable, for two reasons.
The reuse-only case named here is the one that never takes ownership. A switch whose bundle already matches is refused during planning: _plan_llama_phase returns already_selected through _finish_planning_refusal, which sets started: false, and the hook only records ownedJob.current = { startedAt } after if (!started.started) returns early. So a fast reuse-only switch produces no owned job to confuse.
A switch that does start is serialized and is not sub-second. _claim_operation takes _operation_lock non-blocking and stamps started_at before any work, so a second switch cannot start until the first has finished; for both stamps to land in one second the whole of the first job would have to complete inside it. A started switch always spawns the installer for the resolve, then again for the llama phase, then runs the whisper phase. Importing install_llama_prebuilt alone measures 0.11 to 0.16 s here before any download, validation or hardlinking, and the resolve runs with force_refresh=True so it does not read the memo.
Worth noting the blast radius too: the outcome would be a toast attributed to the wrong request, while the installed backend and the shared job state are both correct.
Agreed that a second-granularity timestamp is a fragile identity, and a unique job id would be the right shape if this grows a second writer. As it stands it would mean changing the job contract across the model, the parser, the lifecycle helper and their tests to close a race that needs a sub-second install, so I am leaving it and recording the reasoning here.
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a8b4f599f4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| if not llama_will_run: | ||
| return {} |
There was a problem hiding this comment.
Allow retrying a failed whisper re-pair
When the llama phase succeeds but the slim whisper repair then fails with a retryable exit such as 1 or 3, the llama marker already records the requested backend while the whisper marker still records the old one. Retrying the same selection is classified as already_selected, making llama_will_run false, and this return suppresses the repair phase; the picker is also no longer dirty and the normal whisper update check does not detect the backend mismatch. The user therefore cannot retry the reported repair failure without switching llama.cpp away and back, so permit a repair-only retry when the llama refusal is specifically already_selected and the slim whisper pairing is stale.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Genuine, and fixed in dda83d8. Reproduced the chain at head: the llama phase runs first and writes the marker, so a whisper repair that raises a retryable exit leaves backend_request on the new backend with the slim install still hardlinked to the old runtime. The retry then lands in the already_selected branch, llama_spec is None, and _whisper_phase_plan returned {} on if not llama_will_run, so the repair could never run again.
Worth noting this is an interaction between two earlier fixes on this branch rather than an original defect: making exits other than 2 re-raise is what turned a swallowed repair failure into a reported one, and making a refused switch stay refused is what closed the retry path behind it.
The fix restores what the earlier item asked for more precisely: a repair-only job is allowed for the already_selected refusal specifically, and only while slim_pairing_is_stale() says the slim marker's backend differs from the installed llama backend, which is the same comparison run_repair_phase already makes before doing any work. Gating on staleness matters, otherwise every already-selected request would start a whisper job that finds nothing to do and reports success in place of a clear refusal.
Two regression tests: the retry now plans a repair phase, and a healthy pairing (plus every non-already_selected refusal) still returns no phase. Both fail with the fix reverted. Suites green: 101 passed across the switch, update and whisper freshness tests.
The llama phase runs first and records the new backend, so a retryable whisper failure (a dropped download, an install that was busy) ends with llama.cpp on the requested backend and dictation still hardlinked to the old runtime. Retrying that selection is then already_selected, which skips the llama phase, and the whisper planner refused to run without one. The reported failure was unfixable except by switching away and back. Allow a repair-only job for that one refusal, gated on the pairing actually being stale so an ordinary already-selected request stays a refusal instead of becoming a no-op job that reports success. slim_pairing_is_stale exposes the comparison run_repair_phase already makes before it does any work.
|
@codex review |
|
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". |
unslothai#8520 consolidated the per-field sync_marker_* helpers into one sync_marker_selection driven by _marker_selection_patch, which conflicted with the sync_marker_arch_coverage this branch added. Took main's consolidation and folded the built-arch coverage into _marker_selection_patch instead of keeping a separate helper. It already receives the AssetChoice, so the coverage now rides the single write every reuse path already makes, and the tests move to that writer.
…reads Two fixes on top of this branch, both from review. The progress label was answering with `import torch`. `_torch_step_label` runs before the first pip step of its block, where `_TORCH_RUNTIME_PROBE` is cold, and on the very host the label exists for (Windows, no NVIDIA, no rocminfo or amd-smi) none of the four `_ensure_*` calls that follow reach the probe either: `_ensure_cuda_torch` returns on no-NVIDIA, `_ensure_xpu_torch` on IS_WINDOWS, `_ensure_rocm_torch` at its "no AMD GPU visible via hipinfo" guard, `_ensure_cpu_torch` unless an explicit CPU pin is set. So the new operand was the first probe, spending up to its 90s timeout before `_progress()` had printed anything, on exactly the wedged-driver hosts that timeout exists to rescue. `pip_install` then invalidates the memo before the existing check at the torchao step, so the cost was not amortised either. `_installed_torch_is_windows_rocm_cheap` answers the same question from torch/version.py via `find_spec`, which is the idiom `_installed_torch_version_label` and `_installed_torch_label_on_disk` already use for this exact reason, and falls back to the memoized probe only when something else has already paid for it. Behaviour on the reported Strix Halo host is unchanged. The marker reads were unguarded. `backend` has only been written since unslothai#8520 (2026-08-13); markers go back to unslothai#4562 (2026-03-25), so every install older than that has no such property, and reading a missing property under a caller's `Set-StrictMode -Version 2.0` or higher is a terminating error. The function's only try/catch wraps `ConvertFrom-Json`, so it escaped and aborted setup. `tag`, `published_repo` and `release_tag` had the same hazard, and an empty or truncated marker (an interrupted write leaves one) made the function print "installed release: @" instead of staying quiet. All four reads are now guarded through `PSObject.Properties`. Both printers now share one contract for the value: string only, trimmed, and matching `^[A-Za-z0-9._+-]{1,32}$`. Without it the twins disagree, since PowerShell renders @(1, 2) as "1 2" and Python renders [1, 2] as "[1, 2]", and a newline in the value would split the log line. The vocabulary is cuda, rocm, vulkan, cpu and metal, so nothing real is rejected. The guard uses -ccontains because PowerShell property access is case-insensitive and Python's dict lookup is not. Tests. `test_torch_step_label.py` grows to 164 cases: the full [Windows, Linux, WSL, macOS] x [NVIDIA, AMD with tooling, AMD bundled-runtime, Intel XPU, CPU-only, no torch] matrix, explicit-backend precedence, the off-disk reader, and the cost assertions. `test_installed_release_backend_line.py` is new: 498 cases driving the real `Get-InstalledLlamaPrebuiltRelease` through pwsh and the real `installed_llama_prebuilt_release` through bash, over a marker corpus (every backend, null, non-string, unicode, 64KiB, quotes, backticks, subexpressions, newlines, control characters, malformed and empty files) crossed with StrictMode off, 1.0, 2.0, 3.0 and Latest, plus all twelve historical marker key sets from 2026-03-25 to today, and a byte-for-byte parity assertion between the two printers on every case. Both new assertions discriminate: the legacy-marker StrictMode case and the zero-subprocess case pass on the merge base, fail on this branch before these fixes, and pass after. Recorded, not fixed here: setup.sh names a non-fork binary source ("+ ggml-org@b10715") and setup.ps1 never has. Teaching setup.ps1 that branch changes what Windows prints for upstream bundles, which is a separate change; the divergence is asserted in the new test so it stays a known quantity.
…ling Windows ROCm torch as CPU (#10370) * Studio: name the llama.cpp backend in the install log, and stop labelling Windows ROCm torch as CPU The installer prints "installed release: <repo>@<tag>" and never says which backend the installed bundle runs on, so a host running a Vulkan bundle and a host running a ROCm one produce identical lines. A Strix Halo report came with four install and update logs covering nine days that all read healthy while the machine ran Vulkan; only the server logs, which record the backend, showed it. The marker already carries the resolved backend, so both setup scripts now print it. Separately, the torch progress label falls back to GPU detection when UNSLOTH_TORCH_BACKEND is unset, which is every standalone "unsloth studio update". On Windows that detection probes rocminfo and amd-smi, which ship with the HIP SDK rather than with AMD's bundled-runtime wheels, so the same run printed "torch check (cpu)" a few lines above "dependency overrides (skipped, Windows ROCm)". torch.version.hip is the installed build's own answer and is already read for the torchao override, so the label uses it too. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: read the Windows ROCm verdict off disk, and guard the marker reads Two fixes on top of this branch, both from review. The progress label was answering with `import torch`. `_torch_step_label` runs before the first pip step of its block, where `_TORCH_RUNTIME_PROBE` is cold, and on the very host the label exists for (Windows, no NVIDIA, no rocminfo or amd-smi) none of the four `_ensure_*` calls that follow reach the probe either: `_ensure_cuda_torch` returns on no-NVIDIA, `_ensure_xpu_torch` on IS_WINDOWS, `_ensure_rocm_torch` at its "no AMD GPU visible via hipinfo" guard, `_ensure_cpu_torch` unless an explicit CPU pin is set. So the new operand was the first probe, spending up to its 90s timeout before `_progress()` had printed anything, on exactly the wedged-driver hosts that timeout exists to rescue. `pip_install` then invalidates the memo before the existing check at the torchao step, so the cost was not amortised either. `_installed_torch_is_windows_rocm_cheap` answers the same question from torch/version.py via `find_spec`, which is the idiom `_installed_torch_version_label` and `_installed_torch_label_on_disk` already use for this exact reason, and falls back to the memoized probe only when something else has already paid for it. Behaviour on the reported Strix Halo host is unchanged. The marker reads were unguarded. `backend` has only been written since #8520 (2026-08-13); markers go back to #4562 (2026-03-25), so every install older than that has no such property, and reading a missing property under a caller's `Set-StrictMode -Version 2.0` or higher is a terminating error. The function's only try/catch wraps `ConvertFrom-Json`, so it escaped and aborted setup. `tag`, `published_repo` and `release_tag` had the same hazard, and an empty or truncated marker (an interrupted write leaves one) made the function print "installed release: @" instead of staying quiet. All four reads are now guarded through `PSObject.Properties`. Both printers now share one contract for the value: string only, trimmed, and matching `^[A-Za-z0-9._+-]{1,32}$`. Without it the twins disagree, since PowerShell renders @(1, 2) as "1 2" and Python renders [1, 2] as "[1, 2]", and a newline in the value would split the log line. The vocabulary is cuda, rocm, vulkan, cpu and metal, so nothing real is rejected. The guard uses -ccontains because PowerShell property access is case-insensitive and Python's dict lookup is not. Tests. `test_torch_step_label.py` grows to 164 cases: the full [Windows, Linux, WSL, macOS] x [NVIDIA, AMD with tooling, AMD bundled-runtime, Intel XPU, CPU-only, no torch] matrix, explicit-backend precedence, the off-disk reader, and the cost assertions. `test_installed_release_backend_line.py` is new: 498 cases driving the real `Get-InstalledLlamaPrebuiltRelease` through pwsh and the real `installed_llama_prebuilt_release` through bash, over a marker corpus (every backend, null, non-string, unicode, 64KiB, quotes, backticks, subexpressions, newlines, control characters, malformed and empty files) crossed with StrictMode off, 1.0, 2.0, 3.0 and Latest, plus all twelve historical marker key sets from 2026-03-25 to today, and a byte-for-byte parity assertion between the two printers on every case. Both new assertions discriminate: the legacy-marker StrictMode case and the zero-subprocess case pass on the merge base, fail on this branch before these fixes, and pass after. Recorded, not fixed here: setup.sh names a non-fork binary source ("+ ggml-org@b10715") and setup.ps1 never has. Teaching setup.ps1 that branch changes what Windows prints for upstream bundles, which is a separate change; the divergence is asserted in the new test so it stays a known quantity. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: stop the hip-reader tests reading the runner's real torch The four _torch_hip_version_on_disk cases built a stand-in torch package under tmp_path and prepended it to sys.path, which is enough only when torch is absent. importlib.util.find_spec returns sys.modules[name].__spec__ when the module is already imported, so on any job that installs torch the real package answered, the fixture was ignored, and the reader returned "" instead of the planted hip string. They passed locally for the same reason they failed in CI. _fake_torch_on_path now drops the sys.modules entry as well, so find_spec does a real path search; monkeypatch restores the real torch at teardown. Reproduced the CI shape locally by importing a stub torch before collection: 4 failed before this, 164 pass after. Test-only, the reader itself is unchanged. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: cut the comments on the backend-label change down to the load-bearing ones Opening comment-reduction pass over the lines this PR adds: 173 comment and docstring lines to 73. Deleted first, shortened second. Gone are the docstrings that only restated a test name, the per-row provenance comments that repeated the dict key beside them, the corpus section banners, and the multi-line rationales whose facts already sit one line above in code. Kept, at one line each: why rocminfo and amd-smi are absent on the reported host, why find_spec needs the sys.modules entry dropped, why the guard is -ccontains rather than -contains, why pip_install invalidating the memo is what made the old probe unamortised, and the pre-existing setup.sh upstream-source branch that setup.ps1 has never had. Comments, docstrings and whitespace only. prepush_gate --comment-only passes on install_python_stack.py, setup.ps1 and test_torch_step_label.py. It fails closed on setup.sh and test_installed_release_backend_line.py because the edited comments live inside an embedded-language string (a shell heredoc and a PowerShell harness literal), which no Python or shell lexer can see into, so both were verified by hand instead: the heredoc's Python AST and everything outside it are byte-identical, all 12 changed lines in setup.sh start with #, and the single AST delta in the test file is one # line inside the PowerShell string. 164 and 496 tests still pass, bash -n clean, setup.ps1 parses with zero errors. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: probe bash before using it, so the setup.sh printer test skips on Windows The Windows staging run turned this up: 141 of the new printer cases failed with the expected line compared against UTF-16 text reading "Windows Subsystem for Linux has no installed distributions." C:\Windows\System32\bash.exe is the WSL launcher, not a shell. WSL puts it on the system PATH ahead of Git's bin, so shutil.which("bash") returns it even when no distro is installed, and running it prints that notice to stdout instead of executing the script. The skipif therefore believed bash was available and the harness read the notice as printer output. Microsoft documents the launcher as deprecated in favour of wsl.exe, and the same first-PATH-hit mistake is on record against pnpm and several editors. _usable_bash now runs `bash -c "printf ok"` and accepts the executable only if it prints ok, which is the fix those reports converge on: probe the candidate rather than trusting the first PATH match. A stub that ignores -c is rejected, so the file skips instead of asserting against garbage. Nothing is lost by skipping there: setup.sh is never executed on Windows, since _find_setup_script picks setup.ps1. Verified against a stub that mimics the launcher (prints the notice, ignores -c): the guard resolves to None. 660 tests pass here, ruff clean. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>


Adds a llama.cpp backend selector under Settings > System > GGUF inference engine. Users can switch between Automatic, CPU, CUDA, ROCm, and Vulkan without restarting Studio or reinstalling from the shell.

Behavior
The selector only offers alternatives that have a compatible bundle for the machine and installed llama.cpp release. Vulkan is the broad fallback for NVIDIA, AMD, and Intel GPUs where a compatible Linux or Windows bundle exists. ROCm requires a published artifact matching the AMD GPU's
gfxtarget.Explicit choices are saved in
UNSLOTH_PREBUILT_INFO.jsonand preserved across later updates. Automatic restores hardware detection, whileUNSLOTH_LLAMA_CPP_BACKENDcontinues to override the saved choice.A named backend that cannot be served here fails the install rather than substituting a different one.
install_llama_prebuilt.pymakes that call, including for a choice recorded only in the marker, and reports it with its own exit code;setup.shandsetup.ps1route on that code instead of re-deriving the request from the environment, which is the only part of it they can see.Switching uses the same serialized install job as llama.cpp updates, preventing concurrent updates, switches, or browser tabs from modifying the install together. An active model is unloaded before the bundle is replaced and must be loaded again afterward, but Studio itself does not need to restart. A slim whisper.cpp install borrows llama.cpp's ggml libraries, so it is reinstalled for the new backend once the llama phase lands; stable-diffusion.cpp remains independent.
The feature works in web and Tauri builds that include this change. The previously published v0.1.701-beta desktop binary does not contain it.
Testing