Skip to content

Studio: MOSS-Image GGUF path follows the per-checkpoint negative-branch skip - #16255

Merged
danielhanchen merged 4 commits into
mainfrom
studio-moss-sdcpp-skip-reference
Oct 31, 2026
Merged

danielhanchen merged 4 commits into
mainfrom
studio-moss-sdcpp-skip-reference

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Summary

#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 Fix a small typo blocking pip install #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.

… skip window

SFT sends moss_uncond_skip=false, Base moss_uncond_skip_start=0,moss_uncond_skip_end=0.5
(sigma-percent, as the diffusers path), on both sd-cli --extra-sample-args and the sd-server
sample_params. UNSLOTH_MOSS_REFERENCE_SKIP=0 sends nothing, which keeps sd.cpp's block 22 on
every step. A binary without the keys ignores them and renders as before.
@danielhanchen danielhanchen self-assigned this Oct 31, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T06:04:45.596880Z ae224bf Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

1 similar comment
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

danielhanchen added a commit that referenced this pull request Oct 31, 2026
…up (#16257)

`tests/studio/test_early_python_process_image.ps1` failed its first
check on the Windows PowerShell 5.1 step of `parity (windows-latest)`,
on a staging run for #16255, which does not touch the installer:

```
  FAIL  a WMI query that never returns is abandoned at the deadline
  ...
1 check(s) failed
```

The same check is green on most runs. It is timing-sensitive:
`Get-StudioWmiProcessImageRows -TimeoutSeconds 2` against a query that
sleeps 60 s, and the whole call, including `Start-Job`, `Stop-Job` and
`Remove-Job`, had to finish inside 20 s. On Windows PowerShell 5.1 each
job runs in a fresh `powershell.exe`, and on a loaded hosted runner its
start and stop can push the call past 20 s even though the deadline
itself is honoured. The installer logic is fine. The bound was just too
tight for what it measures.

### Change

- Allow 45 s instead of 20 s. That still separates abandoning the query
at the deadline from waiting out its 60 s.
- Print the elapsed time in the check line, so the next failure shows
how close it came.
- Check the empty result as its own line, so a failure says which half
broke.

### Verification

pwsh 7 on Linux:

| | elapsed | deadline check |
|---|---|---|
| main `install.ps1` | 2.1 s | PASS |
| sabotage: `Wait-Job` without `-Timeout` | 60.3 s | FAIL |
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: ae224bf98d

ℹ️ 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".

@danielhanchen
danielhanchen merged commit 84e32b7 into main Oct 31, 2026
@danielhanchen
danielhanchen deleted the studio-moss-sdcpp-skip-reference branch October 31, 2026 06:05
danielhanchen added a commit that referenced this pull request Oct 31, 2026
## Summary

Every `Core zoo` cell in `consolidated-tests-ci.yml` is now being
cancelled at its 35 minute job cap, on unrelated PRs, with the
unsloth_zoo suite at 99%. It is the same failure #14240 fixed at 25
minutes: the suite has grown past the cap.

A passing cell from today, for scale: the zoo `pytest -n 4` step
reported `14494 passed, 2462 skipped ... in 1770.53s (0:29:30)`, and the
whole job ran 34m57s, three seconds under the cap.

## Change

- `Core zoo` job: `timeout-minutes: 35` -> `50`, comment updated with
the current numbers.
- Unchanged: the 5 minute `PYTEST_TIMEOUT` per test, which is what names
and stack-dumps a genuine hang. The job cap only bounds the total.

## Evidence

Staging Core runs since 2026-10-30 21:28 UTC, Core zoo cells by combo:

| PR | HF=4.57.6 | HF=default | HF=latest |
|---|---|---|---|
| #16041 | failure | cancelled | cancelled |
| #16249 | cancelled | cancelled | cancelled |
| #16250 | cancelled | cancelled | cancelled |
| #16257 | cancelled | cancelled | cancelled |
| #16255 (run 1) | cancelled | success (34m57s) | success (28m46s) |
| #16255 (run 2) | success | cancelled | cancelled |

The cancelled cells end with `##[error]The operation was canceled.`
while the suite is printing its last progress lines (98-99%).

## Tests

`tests/studio/test_zoo_suite_parallel_isolation.py`,
`test_workflow_guards_run_unfiltered.py` and every test that reads
`consolidated-tests-ci.yml`: 267 passed.

## Not proven

- This PR's own CI run is the first measurement at the new cap; whether
50 minutes leaves enough headroom as the suite keeps growing is not
known.
danielhanchen added a commit to Etherll/unsloth that referenced this pull request Nov 7, 2026
…slothai#16815)

## Summary

A Windows user on an 8 GB RTX 3070 could not render MOSS-Image-SFT Q8_0
GGUF. The load succeeded, sampling started, and about 16 seconds later
the Images page said only "Image generation failed." The server log held
no more than this:

```
sd-server generation failed: generation_failed: generate_image returned no results
```

When sd-server fails an image job, the job error is always that generic
string. The real cause (a device allocation that failed, the model
manager running out of room, an abort) only shows up in sd-server's own
output. Studio already appended that output to failed **video** jobs.
For **image** jobs it was dropped, so neither the user nor the exported
log could say what went wrong.

## Changes

- `sd_cpp_server.SdCppServer._run_job`: a failed image job now includes
sd-server's log tail in its message, the same way video jobs already did
(`_diagnostic_tail`: error-marked lines first, then the last few lines,
capped at 1500 characters).
- `routes/inference._generate_failure_detail`: the Images page still
shows only fixed text, never the engine's text.
- The bare `oom` needle now matches only as a whole word. A log tail can
echo the prompt (sd-server's verbose output prints it), and "a cozy
room" is not an out-of-memory failure.
- stable-diffusion.cpp's `cannot make enough memory available` now
counts as out of memory. That warning can also appear before a render
that recovers, but this function only ever sees renders that failed.
- Side effect, intended: image job failures now reach
`note_accelerator_failure_from_output` with the build's own output, as
server deaths and video failures already did. A failed image job that
prints, for example, `no kernel image is available` now counts against
that build. Capacity failures stay excluded there, as before. In the
same way, the existing one-time CPU-backend restart on a ggml
unsupported-op abort and the Vulkan device-lost respawn now also see a
failed job's output, not only a dead server's.

No change to any UI flow. A failure that used to say "Image generation
failed." now says "Image generation failed. The device ran out of
memory. Try a smaller size, fewer steps, or a smaller batch." when the
output shows that.

## Reproduction: VRAM taken after the load

Same Studio HTTP flow the Images page uses: load
`unsloth/MOSS-Image-SFT-GGUF` Q8_0 with 7.5 GiB of VRAM free, then a
second process takes VRAM until only 2 GiB is free, then generate
1024x1024 with 25 steps. Colab G4, the same tier for both arms.

| | main (`04f4f0a`) | this branch |
| --- | --- | --- |
| Images page | `Image generation failed.` | `Image generation failed.
The device ran out of memory. Try a smaller size, fewer steps, or a
smaller batch.` |
| server log | `sd-server generation failed: generation_failed:
generate_image returned no results` | the same, plus the cause (below) |

```
Last output:
[E] MOSS-Image segment 2/43 (moss_image.layers.1) failed during weight preparation --- ggml_runner.cpp:903
[E] diffusion model compute failed --- diffusion_engine.cpp:2825
[E] Diffusion model sampling failed --- diffusion_engine.cpp:3060
[E] sampling for image 1/1 failed after 0.18s --- image.cpp:906
...
[W] model manager cannot make enough memory available on CUDA0: need 1223.37 MB device / 759.59 MB budget, available 1149.19 MB device / 6012.04 MB budget --- model_manager.cpp:2101
```

The main arm's message matches the reporter's log exactly. I also tried
a fix that restarts sd-server so it plans again from the memory that is
free now. It did not help in this reproduction: a freshly started server
failed on the same layer segment (1223 MB needed, 1187 MB available).
With 3 or 4 GiB left, main already renders, because sd.cpp evicts
weights on its own. So the restart is not part of this PR.

I also tried restarting with the text encoder on the CPU
(`--clip-on-cpu`) and retrying. That retry ran, but the render still
failed, this time on a DiT segment: at 2 GiB free, 1223 MB was needed
and 1203 MB was free; at 1.5 GiB free, the prompt encoded on the CPU,
and then a DiT segment needed 1711 MB with 1534 MB free. All it added
was a restart before the same message, so it was dropped as well. At
1024x1024 these are real shortfalls, and the useful thing Studio can do
is say so.

## What was checked for MOSS-Image

The reported repos load and render with current main on every path I
could reach:

| Path | Host | Result |
| --- | --- | --- |
| `unsloth/MOSS-Image-SFT-GGUF` Q8_0 through Studio HTTP (sd-server,
CUDA 13 bundle) | A100 with VRAM held down to 7.5 GiB free | loads,
renders 1024x1024 at 25 steps |
| same, with free VRAM then squeezed to 3 or 4 GiB | A100 | renders,
main and branch |
| `OpenMOSS-Team/MOSS-Image-SFT` pipeline (fetches
`unsloth/MOSS-Image-SFT-FP8`), auto precision | A100, 7.5 GiB free |
int8 + streaming, renders |
| pinned `sd-cli` (`master-982-0518b34-uaba3a1c` and the previous
`-ud331c66`), SFT keys and none | L4, free VRAM 7.5 / 6 / 5 / 4 GiB,
free RAM 10 / 6 GiB | all 13 cells render |
| pinned Windows CPU build, `sd-cli` and `sd-server` with Studio's
request shape, `moss_uncond_skip=false` and none | GitHub
`windows-latest` | all 5 render |
| Studio local CPU, server path | Linux | renders |

So unslothai#16255's sample args and the pinned build are not the cause. The
reporter's failure is the same generic job failure as the reproduction
above, and the reproduction shows how a desktop card that also drives
the display can land there. Separately,
unslothai/stable-diffusion.cpp#50 vendors
leejet/stable-diffusion.cpp#2183. That fix makes the same model-manager
loop read free memory again before it gives up, which matters when the
driver reports freed memory late. It does not change a real shortfall
like the one above.

## Tests

- `test_sd_cpp_server.py::test_img_gen_failure_carries_the_log_cause`:
fails on main (no `Last output:`), passes here.
`test_img_gen_failure_without_output_keeps_the_job_error`: the message
stays unchanged when there is no output.
- `test_diffusion_routes.py`: an image job OOM from the tail is named;
the reproduction's capacity failure is named; a tail that echoes "room /
broom / zoomed" is not called out of memory. None of these leak engine
text.
- `test_differential.py` against `04f4f0a`: DISCRIMINATING, 3 tests
fixed, 194 unchanged, 0 head failures.
- Every `test_sd_cpp*.py`, `test_h3_native*.py`,
`test_diffusion_routes.py` and `test_diffusion_hires.py` file passes.
Adding `test_video_backend.py` to the same run gives the same 165
order-dependent failures on main and on this branch; that file passes on
its own on both.

## Not covered

- No Windows + NVIDIA host was available, so the report itself was not
replayed. Its log will name its cause once it comes from this build.

## Screenshots

Images page on Colab A100. `unsloth/MOSS-Image-SFT-GGUF` Q8_0 was loaded
with 7.5 GiB of VRAM free, then a second process took VRAM until 2 GiB
was left, then Generate was clicked at 1024x1024 with 25 steps. The left
side is main (`04f4f0a`); the right side is this branch. Both captures
come from a real browser.

![Images page error toast, before and
after](https://raw.githubusercontent.com/danielhanchen/unsloth-staging-2/pr-media/pr/16815/pr16815_toast_q-d9594a878fcb.png)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant