Skip to content

Studio: /v1/images/generations keeps a deployed LoRA on MiniMax-H3-Image and dense builds - #17961

Merged
danielhanchen merged 3 commits into
mainfrom
studio-v1-images-keep-deployed-lora
Nov 16, 2026
Merged

danielhanchen merged 3 commits into
mainfrom
studio-v1-images-keep-deployed-lora

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Summary

Follow-up to #17899. After Train > Deploy to Create, two loads still rendered through /v1/images/generations without the deployed LoRA (found running train, deploy and render for 13 families on Colab A100 / G4):

  • MiniMax-H3-Image: it merges load LoRAs into the DiT but never recorded which adapters were behind the merge, so the route sent an empty selection and the backend refused it ("MiniMax-H3-Image merges LoRA adapters into its weights when the model loads ...").
  • Dense builds (bf16 / nf4 / bnb pipelines: SDXL, Z-Image and others): they apply load LoRAs per generation, so an omitted loras field rendered the base model. On SDXL and Z-Image the render without the field was the base image.

Change

  • MiniMax-H3-Image records the specs behind its load-time merge, as the int8 / fp8 bakes already do.
  • Every committed load records the adapters it was asked for (load_lora_specs in the status).
  • An omitted loras on /v1/images/generations now means the adapters the load named: the baked set when there is one, else the load's requested set. [] still renders without any; an explicit list is used as given. The field description is updated.

/images/generate (Studio's own route, which always sends its selection) is unchanged. The native sd.cpp and MLX engines do not record load adapters, so an omitted field there still renders without them, as before.

Two cases now get a clear 400 instead of a silent plain-model image: a deployed LoRA on a dense load that Speed has since compiled ("Speed compiled this model, so LoRAs are off ..."), and a deployed adapter whose file was deleted after the load ("Unknown LoRA").

Tests

  • tests/test_openai_images_baked_loras.py: 4 new tests (an omitted field keeps a dense deploy's adapters, the status reports the load request, every bake including MiniMax-H3-Image records the specs /v1 reads back, dense loads record their requested adapters). They fail on main and pass here; the 9 existing tests pass.
  • Related route, batching and gallery suites pass with no failures on either side.

GPU runs (Studio from main + this change, REST API)

family, load main: /v1 without loras this PR
MiniMax-H3-Image int8, LoRA merged (G4) refused renders with the LoRA, bit-identical to the Studio render
Z-Image bnb-4bit (A100) base image bit-identical to the Studio render with the LoRA
SDXL base dense (A100) base image with the LoRA
FLUX.1, FLUX.2, Qwen-Image-2.1, Krea-2, FLUX.3 int8 bakes with the LoRA unchanged

…age and on dense builds

MiniMax-H3-Image merges its load LoRAs into the DiT but never recorded the
load request behind them, so after Deploy to Create the OpenAI route sent an
empty selection and the backend refused it (500 Image generation failed).
Record the baked specs on that path as the int8 / fp8 bakes do.

A dense load (bf16 / nf4 / bnb pipelines: SDXL, Z-Image, FLUX.2 Klein) applies
its load LoRAs per generation, so an omitted loras field rendered the base
model. Every committed load now records the adapters it was asked for, and an
omitted loras field falls back to them after the baked set.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T11:18:03.798579Z 46d8425 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 2362fc8ec5

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

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 46d8425bd0

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

[skip ci]
@danielhanchen
danielhanchen merged commit 2c7aa21 into main Nov 16, 2026
@danielhanchen
danielhanchen deleted the studio-v1-images-keep-deployed-lora branch November 16, 2026 12:42
danielhanchen added a commit that referenced this pull request Nov 16, 2026
…ate no longer drops it), HunyuanImage-2.1 LoRA gated off (#17993)

## Summary

A LoRA deployed with "Deploy to Create" on an int8 / fp8 image load was
silently dropped by any `/images/generate` call that left `loras` out.
That includes direct API calls and every internal caller built from such
a request: the chat `generate_image` tool, the queue and XY cells.

- The engine reads a missing LoRA selection as "none". On a load that
baked its adapters into the quantized weights, "none" sets every baked
adapter's weight to 0.
- The image then renders without the LoRA, with no error.
- `/v1/images/generations` already resolves an omitted list to the
load's adapters (#17899, #17961); the native route did not.

Three smaller gaps found by the same LoRA matrix are fixed too.

## Change

- **`/images/generate`:** an omitted `loras` now means the adapters the
model was loaded with (the baked set, or the set a dense load named), at
their load weights. A load that named none still renders with none. An
empty list `[]` renders without any adapter.
- This is a behaviour change for API callers that relied on "omitted =
none" after a LoRA load; they now need to send `[]`.
- The field description in `models/inference.py` documents the new
meaning.
- Exception: a dense load that Speed compiled (it reports
`supports_lora: false`) resolves an omitted list to none, so turning a
LoRA off and letting Speed compile never brings it back as a refused
request. The baked set of an int8 / fp8 load still resolves.
- Resolving an omitted list pins the load it was read from (also when it
resolved to none), so a model swapped in before the generation slot is
retried with its own adapters.
- **Images page:** sends `[]` instead of omitting the field when no
adapter is active, so turning a LoRA off in the UI still turns it off.
- **Compare grid (frontend) and server XY grid:** a cell whose LoRA
weights are all 0 sends `[]` instead of omitting `loras`, so it stays
adapter-free under the new meaning.
- **HunyuanImage-2.1:** gated off for LoRA. Its diffusers pipeline has
no `load_lora_weights`, so every LoRA generation and every int8 / fp8
LoRA load on it failed with an AttributeError. A new test checks that
every diffusers image family either has a LoRA loader or is listed as
gated off.

## Results

Real GPU, Colab G4, Z-Image int8 through the REST API, compiled, same
seed:

| request | main | this PR |
|---|---|---|
| `loras` omitted after a Deploy-to-Create LoRA load | renders without
the LoRA (same as `[]`; LoRA vs none LPIPS 0.147) | renders with the
LoRA (same as sending it) |
| `loras: []` | no LoRA | no LoRA |

HunyuanImage-2.1 on main, same G4: the bf16, INT8-attention and fp16
LoRA cells fail to render, and the int8 / fp8 LoRA loads fail at load.
With this PR the family no longer offers LoRA.

The same G4 matrix checked LoRA application across 18 bf16 families plus
GGUF, sd.cpp, nf4, fp16, INT8 attention and baked int8 / fp8 loads.

## Tests

- New `tests/test_images_generate_load_loras.py`: omitted `loras`
renders with the baked set; a dense load keeps the adapters it named;
the chat `generate_image` tool keeps the baked set; `[]` renders with
none. 3 fail on main.
- `tests/test_diffusion_lora.py`: HunyuanImage-2.1 is gated off, and
every diffusers pipeline family has a LoRA loader or is gated off. Both
fail on main.
- Also in `tests/test_images_generate_load_loras.py`: a compiled dense
load that omits `loras` renders without its named set, and a load
swapped in before the slot retries with its own set. Both fail without
their fix.
- The loader test names every family it cannot check on the installed
diffusers (FLUX.3 needs 0.42+, MOSS-Image has its own loader,
MiniMax-H3-Image merges at load), and any other missing class fails.
- `tests/test_diffusion_xy.py`: an all-zero LoRA cell drops the adapter.
Fails on main.
- `studio/frontend/tests/images-compare-grid.test.ts`: the all-zero cell
assertion fails on main; the file passes (47).
- Backend LoRA, XY, routes and `/v1` baked LoRA suites: 914 passed.

## Not covered

- The HunyuanImage-2.1 refusal was not re-run on GPU after the gate.
- Studio UI journeys were not driven in a browser; the UI change only
affects the request body (`[]` instead of a missing field).
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