Repository navigation
Studio: pin the master-982 stable-diffusion.cpp prebuilt so MOSS-Image GGUFs load - #14565
Conversation
…GUFs load MOSS-Image support landed upstream in master-975 (leejet/stable-diffusion.cpp#2148, split QKV GGUF loading #2160). The previous base, master-968, cannot load the transformer. Raise the floor the pin tests assert from 968 to 975 and keep the previous pin in the macOS --mmap table.
Codex Review SummaryThis 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. |
|
The account paying for this security review has reached its Codex usage limits. The payer can check the Codex usage dashboard. For personal accounts, using credits requires enabling “Use credits for security reviews” in Code review settings. If you do not manage the paying account, contact this repository's admins. |
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! 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". |
…er lists them (#14860) ## Problem Since the master-982 pin (#14565), the resident sd-server ignores image LoRAs that Studio stages for it. `materialize_native_dir` stages each adapter as a symlink from the per-request `gen_*` directory, under `--lora-model-dir`, to the file in the LoRA cache. In sd-server at `0518b34` (unchanged in the Unsloth patch set): - `examples/server/runtime.cpp:294-298` (`refresh_lora_cache`) calls `fs::canonical` on every entry and skips any entry that resolves outside the LoRA directory. - `examples/server/runtime.cpp:336-338` (`get_lora_full_path`) repeats the containment check on the canonical path and requires a regular file. So the staged symlink is never listed. The structured `lora` entry then fails to resolve, and the request is rejected. With the real master-982 CPU `sd-server`, `/sdapi/v1/loras` lists a regular file and a hard link but leaves out Studio's symlink. The server log shows `skipping inaccessible LoRA or path outside LoRA directory ... runtime.cpp:297`. ## Fix `materialize_native_dir` gains `real_files=True`, which stages a hard link with the existing copy fallback (for example across filesystems). The server generation path passes it. A hard link's canonical path stays inside the server directory, so sd-server's containment check is satisfied and stays fully in force. sd-cli staging is unchanged: it resolves `<lora:...>` tags with `fs::exists` / `is_regular_file`, which follow symlinks. ## Tests - `test_materialize_native_dir_real_files_hardlinks_inside_dest`: checks the staged file is not a symlink, its canonical path is inside the destination, and it is the same inode as the source. - `test_materialize_native_dir_real_files_copies_when_hardlink_fails`: checks the copy fallback when `os.link` raises. - `test_generate_server_stages_loras_as_real_files_inside_the_lora_dir`: runs the real materializer through server-mode `generate`, checks the staged file resolves inside `--lora-model-dir`, and checks that cleanup leaves the source intact. - On main, these 3 tests fail. With the fix, `test_diffusion_lora.py` and `test_sd_cpp_backend.py` give 190 passed. - With the real master-982 `sd-server`, the main materializer's output is skipped and the fixed materializer's output is listed. ## Not covered - No full image render with a LoRA through the server: there is no tiny sd.cpp image GGUF on this host. Only the scan and resolve steps were exercised against the real binary. - No Windows run. `os.link` on NTFS should work, and the copy fallback covers FAT and exFAT.
Summary
Moves Studio's pinned stable-diffusion.cpp prebuilt from
master-968-8cd731e-ubdb47d1tomaster-982-0518b34-ud331c66, the build published today from unslothai/stable-diffusion.cpp#34. master-968 predates MOSS-Image (upstream master-975, which also brought split-QKV GGUF loading), so a MOSS-Image GGUF cannot load on the current pin; every other family keeps working on the new base.What it does
studio/install_sd_cpp_prebuilt.py:DEFAULT_TAG = "master-982-0518b34-ud331c66", with the comment explaining why master-968 is no longer enough.UNSLOTH_SD_CPP_TAGstill overrides, and a missing tag still falls back to latest.test_sd_cpp_args.py,test_sd_cpp_vulkan_cpu_torch.py,test_diffusion_more_families.py,test_sd_cpp_install.py) move to the new tag; the previous pin stays in the accepted-tags list.Checks
UNSLOTH_BUILD.txtin the Linux CUDA 12 bundle names source commitd331c66caaand the MOSS-Image architecture marker is present in bothsd-cliandsd-server.install_sd_cpp_prebuilt.py --accelerator cuda --cuda-major 12into a scratch directory, then rendered a MOSS-Image-SFT UD-Q4_K_XL GGUF through Studio's ownSdCppDiffusionBackend(server mode, 512x512, 20 steps, CFG 3) on a B200: the router picked sd.cpp, the model loaded and the render came out clean (a fox in snow with the prompted sign text).SdCppDiffusionBackendin server mode, 512x512, seed 42, each arm in its own process (the runningsd-serverbinary checked per arm):Old vs old and two renders in one process were also bit-identical, so the comparison could have caught any change. Load time and peak VRAM matched within noise (the arms shared cards, so no speed claim).
test_sd_cpp_install.py,test_diffusion_more_families.py,test_sd_cpp_args.py,test_sd_cpp_vulkan_cpu_torch.py: 411 passed, 1 skipped.Not verified
--lora-apply-mode autoheuristic for quantized weights), edit / img2img, Qwen-Image-Edit and Layered, MiniMax-H3 video, and the CUDA 13 / Vulkan / ROCm / CPU / macOS / Windows bundles.test_sd_cpp_args.py::test_native_speed_flags,::test_minimax_h3_video_command_has_all_joint_av_components,test_sd_cpp_install.py::test_safe_extractall_installs_a_chain_the_loader_can_still_walkon macOS;test_sd_cpp_install.py::test_a_failure_finalising_the_new_tree_is_an_incomplete_replacementon Windows). Only the pinned tag strings change in those files, and these tests run on those runners only when a PR touches them, so they fail the same way on main.