installer: add pipe-safe --cpu / --vulkan flags for the llama.cpp backend (#7213) - #7675
installer: add pipe-safe --cpu / --vulkan flags for the llama.cpp backend (#7213)#7675LeoBorcherding wants to merge 2 commits into
Conversation
…kend (unslothai#7213) UNSLOTH_LLAMA_CPP_BACKEND=cpu placed before `curl ... | sh` binds the var to curl, not the piped sh, so setup.sh never sees it and installs the auto-detected backend (Vulkan on an Intel/other iGPU, which crashed the reporter). Add --cpu / --vulkan flags to install.sh and install.ps1 that export the env var setup.sh already reads, so `| sh -s -- --cpu` works, forward it across the WSL reroute, and document the correct post-pipe env form. No selection-logic change.
|
@codex review |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Overall this is a clean, well-scoped fix and the root cause (the 1. (medium) install.ps1 leaks
|
…leak into the iex session Set the flag-derived backend only around the setup.ps1 invocation with save/restore, mirroring UNSLOTH_STUDIO_HOME / UNSLOTH_LOCAL_LLAMA_CPP_DIR, so `irm | iex` doesn't leave $env:UNSLOTH_LLAMA_CPP_BACKEND set in the caller's session and a later same-session install can't silently reuse it. Pin the cleanup in the wiring test and loosen the whitespace-exact ps1 assertions.
Problem
Forcing the CPU llama.cpp build doesn't work through the documented pipe:
The
VAR=xprefix binds tocurl, not theshon the other side of the pipe, sosetup.shreads the backend as unset, auto-detects the reporter's Intel iGPU, andinstalls the Vulkan prebuilt (their
UNSLOTH_PREBUILT_INFO.json:force_cpu: false,a vulkan asset). The selection logic is correct: when the var actually reaches the
environment,
setup.shforwards--force-cpuand the install honours it. It justnever arrives.
install.shalready documents this same pipe footgun for--no-torchand solves it with a flag; there was none for the backend.
Fix
Add
--cpu/--vulkanflags toinstall.shandinstall.ps1, mirroring--no-torch, that exportUNSLOTH_LLAMA_CPP_BACKENDso it survives the pipe:Also forwarded across the WSL reroute, and the header now shows the correct
post-pipe env form. No change to backend selection, prebuilt resolution, or setup.
An explicit flag wins over an inherited env var, matching the other flags.
Tests
New
tests/sh/test_llama_backend_flag.sh(11 checks) pins the flag to env-varwiring in both installers and the WSL forward; existing
test_install_pipe_safety.shand
test_with_llama_cpp_dir_flag.shstill pass; both installers parse clean.Not verified end to end (no Intel-iGPU host here). The reporter can confirm with
... | sh -s -- --cpu, then checkforce_cpu: trueand a cpu asset in the marker.