unsloth/studio/backend/models
Daniel Han 7085d421c2 Fix batched generation crashes, cache keying and unreplayable recipes
Four bugs in the batched inference path, all found by review:

- A mixed-prompt batch sent a scalar negative prompt against a prompt
  list. Z-Image asserts on the length, and Qwen-Image, Krea 2 and FLUX
  true-CFG encode a batch-1 negative against batch-N latents and fail in
  the transformer's text/image concat. Broadcast it to match the batch.
- The FBCache step-cache reset sat above the chunk loop. diffusers only
  resets that state at the end of a successful call, so a forward that
  raised (the OOM the backoff is meant to recover) left its own residual
  behind and the halved retry died on a shape mismatch. Reset before
  every forward instead.
- The conditioning cache keyed on the checkpoint alone, but a GGUF or
  single-file load takes its text encoders from the companion base, so
  the same checkpoint against a different base reused the previous
  base's embeddings. Key the base too.
- Gallery records stored the base seed and the requested batch size even
  when a prompts/seeds list drove the run, so restoring the second image
  of seeds=[5, 99] replayed seed 5. List-driven outputs now record as
  single-image recipes on their own seed.

Also bound strength above 0: every img2img pipeline derives its step
count from it, so 0 leaves zero denoising steps and either raises or, on
SDXL, crashes on empty latents.
2026-07-26 08:11:20 +00:00
..
.gitkeep fix: restore models directory files deleted during restructure 2026-02-02 19:36:30 +00:00
__init__.py Import diffusion training schemas from models.training directly 2026-07-01 22:11:43 +00:00
auth.py Studio: make the Cloudflare tunnel opt-in (off by default) (#7046) 2026-07-15 06:13:25 -07:00
data_recipe.py Studio: make code comments and docstrings more succinct (#6029) 2026-06-08 23:07:28 -07:00
datasets.py Studio fix recipe dataset preview (#6031) 2026-06-09 14:02:00 +02:00
export.py Studio: multi-select export formats, portable FP8/INT8, GGUF LoRA, and source parity (#6767) 2026-07-03 08:25:10 -07:00
inference.py Fix batched generation crashes, cache keying and unreplayable recipes 2026-07-26 08:11:20 +00:00
mcp_servers.py studio: show MCP "Import config" on the add-server form (#6030) 2026-06-11 16:17:22 +01:00
models.py Merge origin/main into image-generation (PR #6763) 2026-07-25 00:34:38 -07:00
providers.py fix(studio): persist connection model selections for remote clients (#7298) 2026-07-23 19:11:50 -07:00
responses.py Studio: make code comments and docstrings more succinct (#6029) 2026-06-08 23:07:28 -07:00
training.py Fix diffusion dataset 500s, the dropout-1.0 no-op run and the reset base pick 2026-07-26 08:00:34 +00:00
users.py Studio: make code comments and docstrings more succinct (#6029) 2026-06-08 23:07:28 -07:00