Repository navigation
fix(studio): opt-in source-build GPU smoke validation - #7322
danielhanchen merged 5 commits into
Conversation
Gap 1 (empty CUDA arch -> CPU) already landed in unslothai#6481. Wire gap 2: after a GPU source build, optionally run the same staged llama-server smoke test as the prebuilt path, then CPU-fallback on failure. Gated by UNSLOTH_LLAMA_STAGED_VALIDATION (default off) to avoid Blackwell JIT stalls.
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 67c99c65a1
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| case "${UNSLOTH_LLAMA_STAGED_VALIDATION:-}" in | ||
| 1|true|TRUE|yes|YES|on|ON) return 0 ;; | ||
| *) return 1 ;; |
There was a problem hiding this comment.
Normalize the source-smoke opt-in env value
When users opt in with a common environment spelling such as UNSLOTH_LLAMA_STAGED_VALIDATION=True or with surrounding whitespace, the Python helper enables staged validation because it strips and lowercases the value, but this shell gate rejects it and skips the new source-build smoke test. That makes the prebuilt and source-build paths disagree on the same documented opt-in and can still install an unvalidated GPU source build for those values.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Addressed in 09efc49.
_staged_validation_enabled() now strips whitespace and lowercases UNSLOTH_LLAMA_STAGED_VALIDATION before the truthiness check, matching staged_validation_enabled() in install_llama_prebuilt.py. Values like True and yes now opt in on the source-build path too.
Tests: tests/sh/test_staged_validation_enabled.sh (17 passed, including True and whitespace cases).
…7322) Strip and lowercase UNSLOTH_LLAMA_STAGED_VALIDATION before the shell gate so values like True and surrounding whitespace match the Python staged_validation_enabled() helper.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 09efc490be
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| GPU_BACKEND="" | ||
| run_quiet_no_exit "build llama-server (cpu fallback)" cmake --build "$_BUILD_TMP/build" --config Release --target llama-server -j"$NCPU" || BUILD_OK=false | ||
| if [ "$BUILD_OK" = true ]; then | ||
| run_quiet_no_exit "build llama-quantize (cpu fallback)" cmake --build "$_BUILD_TMP/build" --config Release --target llama-quantize -j"$NCPU" || true |
There was a problem hiding this comment.
Rebuild visual server after smoke fallback
When UNSLOTH_LLAMA_STAGED_VALIDATION=1 and a CUDA/ROCm/Metal source build compiles but fails the smoke, this fallback deletes _BUILD_TMP/build after the normal best-effort visual-server target was built and then rebuilds only llama-server/llama-quantize. The install swap later links llama-diffusion-gemma-visual-server only if it exists, so DiffusionGemma auto-serving loses the bundled visual runner on this path even though the normal source-build path provides it; please mirror the best-effort visual-server build here as well.
Useful? React with 👍 / 👎.
…#5854) Mirror the primary source-build path by best-effort building llama-diffusion-gemma-visual-server after smoke-failure CPU fallback.
|
Fixed in a06719e. P2 — Rebuild visual server after smoke fallback: Valid. Staged-validation CPU fallback now best-effort builds |
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. 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". |
|
Ready for review — undrafted after @danielhanchen's commits on ``. Maintainer changes incorporated; awaiting CI + review. |
|
Reviewed and verified. This adds an opt-in source build GPU smoke validation so a broken source build is caught before use, without forcing the check on users who do not want it. Confirmed the flag defaults off and the validation only runs when explicitly requested. Codex review has no open items. The remaining red CI is pre-existing upstream breakage (Core HF/TRL and Repo tests CPU) unrelated to this change. Good to merge. |
Fixes #5854
Problem
#6481 already fixed gap 1: empty CUDA arch detection no longer silently produces a PTX-only source build. Gap 2 remained open: after a GPU source build,
setup.shacceptedllama-serverwith no runtime smoke test, unlike the prebuilt path. A binary that links but cannot run on the host GPU/driver could still be installed.The full GPU forward-pass smoke is intentionally off by default (
_RUN_STAGED_PREBUILT_VALIDATION = False) because it JIT-compiles CUDA kernels and stalls installs for minutes on Blackwell. Daniel left #5854 open for wiring the source path into that same opt-in switch.Fix
studio/install_llama_prebuilt.py: Addstaged_validation_enabled()(UNSLOTH_LLAMA_STAGED_VALIDATIONor the existing constant), use it invalidate_prebuilt_choice, and add--validate-install/--install-kindto run the staged smoke against an existing build tree.studio/setup.sh: After a successful GPU source build (before the install swap), if staged validation is enabled, run--validate-install; on failure, reuse the existing_gpu_fallback_labelCPU retry path.--validate-install; wire intotests/run_all.shandstudio-backend-ci.yml.Verification
bash -n studio/setup.sh bash tests/sh/test_staged_validation_enabled.sh bash tests/sh/test_resolve_cuda_archs.sh python -m pytest tests/studio/install/test_install_llama_prebuilt_logic.py -k 'staged_validation or validate_existing_install or validate_prebuilt_choice_approved' -q25 shell assertions + 10 Python tests pass. Default remains off (no Blackwell stall).
Compatibility
UNSLOTH_LLAMA_STAGED_VALIDATION=1(or the module constant).