Repository navigation
Studio: MOSS-Image negative-branch layer skip follows the reference workflows per checkpoint - #16127
Merged
Merged
Conversation
…orkflows per checkpoint SFT renders without the block-22 skip in the negative branch; Base skips block 22 while sigma is in the first half of the shifted schedule (sigma-percent 0 to 0.5). UNSLOTH_MOSS_REFERENCE_SKIP=0 restores block 22 on every step for both. A pipeline built without the loader keeps the official default, so reference parity holds.
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. |
Member
Author
|
@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". |
Member
Author
|
Heads up on the red checks here:
|
This was referenced Oct 30, 2026
meefs
pushed a commit
to meefs/unsloth
that referenced
this pull request
Oct 31, 2026
…ch skip (unslothai#16255) ## Summary unslothai#16127 made the diffusers MOSS-Image path skip transformer block 22 on the negative pass per checkpoint, as the reference workflows do: never for MOSS-Image-SFT, and only while sigma-percent is in [0, 0.5] for MOSS-Image-Base. The GGUF path runs stable-diffusion.cpp, which still skips block 22 on every step for both checkpoints. unslothai/stable-diffusion.cpp#40 added sample args that express the per-checkpoint rule. This sends them from Studio and pins the prebuilt that reads them. The pinned release, `master-982-0518b34-uaba3a1c`, is published on unslothai/stable-diffusion.cpp; the 7 asset names `test_sd_cpp_vulkan_cpu_torch.py` lists are all in it. ## Change - `sd_cpp_args.moss_uncond_skip_sample_args`: `moss_uncond_skip=false` for SFT, `moss_uncond_skip_start=0,moss_uncond_skip_end=0.5` for Base. Base is detected from the repo id, folder or GGUF filename (separators folded). `UNSLOTH_MOSS_REFERENCE_SKIP=0` sends nothing, which is the binary's every-step default. - `sd_cpp_backend`: MOSS-Image requests carry it, as `sample_params.extra_sample_args` on the server path and `--extra-sample-args` on the CLI path. Other families send nothing. - `install_sd_cpp_prebuilt.DEFAULT_TAG`: `master-982-0518b34-ud331c66` -> `master-982-0518b34-uaba3a1c`. Same upstream base (master-982); the new build adds only unslothai#40. The tests that name the pin are updated. A build without the keys ignores them, so an older install keeps today's behaviour until it updates. ## Results `MOSS-Image-Base-Q4_K_M.gguf`, Linux x86_64 CPU, 256x256, 25 steps, `euler`, the release's own `sd-cli`: | case | negative passes that skip block 22 | |---|---| | new pin, no keys | 25 of 25; PNG byte-identical to the current pin | | new pin, SFT (`moss_uncond_skip=false`) | 0 of 25 | | new pin, Base (window `0..0.5`) | 13 of 25 (steps 1-13) | | current pin given the keys | keys ignored; identical to the same binary without them | The server path, driven through this branch's `build_img_gen_request` and `SdCppServer`, gives the same counts: 25, 0 and 13 of 25. ## Tests - `test_sd_cpp_moss_uncond_skip.py` (new): Base / SFT detection across repo ids, folders and GGUF names, the env kill switch, the server request field, the CLI flag, and that other families send nothing. - `test_sd_cpp_moss_uncond_skip.py`, `test_sd_cpp_args.py`, `test_sd_cpp_install_verify.py`, `test_sd_cpp_vulkan_cpu_torch.py`, `test_diffusion_more_families.py`: 310 passed. ## Not proven - Only the Linux x86_64 CPU bundle was run. The CUDA, Vulkan, Metal, Windows and aarch64 bundles were built by the release job but not rendered. - The MOSS-Image-SFT GGUF was not rendered on the GGUF path; its 0-of-25 count comes from the Base GGUF given the SFT keys.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Studio skips transformer block 22 in the MOSS-Image negative (unconditional) branch on every step, for both checkpoints. The reference workflows do this per checkpoint instead:
It is the same mechanism Studio already has: the reference node only changes the negative pass (it drops block 22 there), it adds no third forward. Its window is in sigma-percent of the shift-5 schedule, so the skip is active while
sigma >= 5 * 0.5 / (1 + 4 * 0.5) = 0.833. At 25 steps that is steps 0 to 12 (13 of 25) on both Studio schedules (sgm_uniformandtraining_grid), the same 13 steps the reference sampler gets.The official model cards recommend block 22 on every step at 50 steps / CFG 3. The reference workflows instead use 25 steps / CFG 2.5 with the per-checkpoint skip above. Studio follows the reference workflows, so this goes with the 25 / 2.5 defaults change.
Changes
MOSSImagePipeline.__call__: newuncond_skip_start/uncond_skip_end(sigma-percent, as above). Whenuncond_skip_layersis not passed, the pipeline uses the checkpoint the loader recorded (reference_uncond_skip). A pipeline built without the loader keeps the official default (block 22 on every step), so the bit-for-bit parity tests against the official pipeline are unchanged.load_moss_image_pipeline(..., checkpoint=...)records the upstream repo id.diffusion.pypassesbasefrom both load paths. Any id that spells MOSS-Image-Base (separators ignored, so mirrors and hub cache folders match too) gets the Base policy. Everything else gets the SFT policy.UNSLOTH_MOSS_REFERENCE_SKIP=0restores block 22 on every step for both checkpoints. It is read on each render.uncond_skip_layers/uncond_skip_endarguments still take precedence.Quality and speed (A100 40GB, real weights, same VM for every arm)
Setup: 1024x1024, 25 steps, CFG 2.5, empty negative, 4 prompts x 2 seeds. Arms are interleaved per (prompt, seed). "old" is the kill switch and "new" is this PR. I counted the skipped negative-branch steps on every render: SFT old 25 / new 0, Base old 25 / new 13. Two reference recipes per image:
Peak VRAM is 27.3 GiB in every arm.
How to read this:
Tests
tests/test_diffusion_moss_image.py: 18 new cases, all of which fail on main:tests/test_diffusion_moss_image_quant.py: the loader stub now keeps attributes and checks the recorded checkpoint.Not covered
sgm_uniformand an empty negative, so the renders are not pixel-comparable to the reference workflow output.