Repository navigation
Merge upstream master-982 (MOSS-Image) and port the ggml patches to dc99877 - #34
Conversation
…ubmodule) Upstream master-982 moves the ggml submodule from d25b121 to dc99877 (leejet#2147), so 0001-0007 and 0009 no longer applied. Ported by cherry-picking each patch onto the new submodule commit; conflicts were adjacent additions plus four API moves: load_tile lost its swz template argument, launch_fattn gained async_kv_preload before the occupancy arguments, rms_norm_f32 now takes nchannels/nsamples and a do_scale/scale_out pair, and ggml_cuda_should_use_mmvf takes warp_size.
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0a687648ee
ℹ️ 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".
| @@ -0,0 +1,49 @@ | |||
| { | |||
| "schema_version": 1, | |||
| "id": "moss-image-sft", | |||
There was a problem hiding this comment.
Reuse one recipe for both MOSS checkpoints
The Base and SFT recipe files declare identical slots, defaults, and feature sets; only their identifiers, names, descriptions, and URLs differ. Exposing moss-image-sft as a separate entry therefore splits same-task checkpoints without a component or capability distinction, contrary to rule 4 of examples/server/recipes/README.md, which requires such variants to reuse the family recipe. Consolidate both checkpoints under one MOSS recipe.
AGENTS.md reference: AGENTS.md:L85-L87
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Trigger builds for embedded recipe changes
The server now embeds every examples/server/recipes/*.json file into the executable at configure time, but neither the push nor pull_request path filter includes those JSON files or recipes_builtin.h.in. Because a GitHub Actions paths filter runs only when at least one changed path matches, a recipe-only change skips this entire build workflow and receives no binary-build validation; add the recipe directory and generated-header template to both filters. See GitHub's workflow syntax.
Useful? React with 👍 / 👎.
…e GGUFs load (#14565) ## Summary Moves Studio's pinned stable-diffusion.cpp prebuilt from `master-968-8cd731e-ubdb47d1` to `master-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_TAG` still overrides, and a missing tag still falls back to latest. - Tests that name the pinned bundle and its asset names (`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 - The release carries the same 13 assets as master-968 (Linux x86_64 CPU / Vulkan / CUDA 12 / CUDA 13, Linux aarch64, Windows CPU / Vulkan / CUDA 12 / CUDA 13, macOS arm64 / x86_64, manifest, sha256 list), so no platform loses its bundle. - `UNSLOTH_BUILD.txt` in the Linux CUDA 12 bundle names source commit `d331c66caa` and the MOSS-Image architecture marker is present in both `sd-cli` and `sd-server`. - Installed through `install_sd_cpp_prebuilt.py --accelerator cuda --cuda-major 12` into a scratch directory, then rendered a MOSS-Image-SFT UD-Q4_K_XL GGUF through Studio's own `SdCppDiffusionBackend` (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). - Old pin vs new pin, same host, same Studio code, Studio's own `SdCppDiffusionBackend` in server mode, 512x512, seed 42, each arm in its own process (the running `sd-server` binary checked per arm): | Family (Q4_K_M GGUF) | Steps | Old vs new pixels | |---|---|---| | Z-Image-Turbo | 8 | bit-identical | | FLUX.2-klein-4B | 4 | bit-identical | | FLUX.1-schnell | 4 | bit-identical | | Qwen-Image | 20 | bit-identical | | Qwen-Image-2.1 | 20 | bit-identical | | FLUX.3 Image Klein | 4 | bit-identical | 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). - Tests: `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 - Only the Linux CUDA 12 bundle was installed and run here; the Windows, macOS, Vulkan and aarch64 bundles are checked by asset name only (staging covers the install path on Windows and macOS). - Paths the 14 upstream commits between the two bases touch beyond MOSS-Image were not rendered: LoRA (the `--lora-apply-mode auto` heuristic for quantized weights), edit / img2img, Qwen-Image-Edit and Layered, MiniMax-H3 video, and the CUDA 13 / Vulkan / ROCm / CPU / macOS / Windows bundles. - The Windows and macOS staging legs fail three tests this PR does not change (`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_walk` on macOS; `test_sd_cpp_install.py::test_a_failure_finalising_the_new_tree_is_an_incomplete_replacement` on 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.

Merges upstream leejet/stable-diffusion.cpp master-982 (0518b34) into the fork, which adds MOSS-Image (from master-975), and ports our carried ggml patches onto the new leejet/ggml submodule (d25b121 -> dc99877).
Upstream merge
Three conflicts:
ggml_block.hpp: duplicate includes, took upstream.diffusion_engine.cpp: upstream feat: enhance decision in --lora-apply-mode auto for quantized parameters leejet/stable-diffusion.cpp#2162 now refuses an immediate LoRA merge whenever load-time quant rules exist, which covers the fork's narrower CPU-only check, so upstream is taken verbatim.model_manager.cpp: upstream feat: support MOSS split QKV weights and batch host loading leejet/stable-diffusion.cpp#2160 rewrote batching for split QKV. Kept upstream's lambda and re-added the fork's!sd_weight_may_be_cpu_repacked(first)guard.ggml patches
0008 and 0010-0013 apply as is. 0001-0007 and 0009 were rebuilt as commits on the old base, cherry-picked onto dc99877 and regenerated. Five needed real changes:
load_tilelost itsswzargument.launch_fattngainedasync_kv_preloadbefore our occupancy arguments. Passed positionally, our function pointer would have become that bool, so the longseq calls now pass it explicitly.rms_norm_f32gainednchannels/nsamplesanddo_scale/scale_out; the small-row launcher is ported to match.ggml_cuda_should_use_mmvfgainedwarp_size.Applying the regenerated patches in order to a fresh dc99877 gives a tree identical to the ported branch.
Results (B200, sm_100, CUDA 13.1, 512x512, seed 42, base = master bdb47d1 rebuilt with the same toolchain)
get sd version from file failed; candidate renders, repeat identicalThe non-publishing prebuilt build of this branch covers the Windows, macOS / Metal, Vulkan, ROCm, CPU and CUDA 12.8 legs.