Repository navigation
Studio: load Anima, Chroma, MOSS-Image and int4 Krea 2 ComfyUI single files - #16710
Conversation
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. |
|
@codex review |
|
This branch adds |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 70d8f65ec7
ℹ️ 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".
| if is_anima_family(fam): | ||
| return ANIMA_COMPONENTS |
There was a problem hiding this comment.
Treat the bundled Anima conditioner as a supplied component
For an Anima single-file load, the checkpoint already supplies text_conditioner, but returning all ANIMA_COMPONENTS makes the artifact planner download the base repo's conditioner weights too: _base_file_downloaded only excludes transformer weights. The locality checks likewise exclude only fam.denoiser_attr, so an otherwise complete local base containing the conditioner config but no conditioner weights is rejected even though the loader obtains those weights from the checkpoint. Treat the conditioner weights as replaced/config-only in single-file download and completeness checks, while retaining its config.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
The single-file load is correct as it stands: the base's text_conditioner weights are a one-time 269 MB fetch that the loader never opens, so this costs download time, not a failed load. The local check runs only for a user-supplied local base_repo, and an Anima diffusers folder lacks those weights only if someone deletes them by hand.
Fixed in 156779a: |
|
Codex Review: Didn't find any major issues. 🚀 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". |
|
Codex Review: Didn't find any major issues. Bravo. 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". |
|
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". |
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! 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". |
…er rows (#16838) ## Summary `seam-guard` (`studio/backend/tests/test_diffusion_autoopt_parity.py`) fails on main and on every PR that runs it, for example the staging runs for #16711 and #16799: ``` FAILED tests/test_diffusion_autoopt_parity.py::test_autoopt_resolves_the_same_optimizations_as_before FAILED tests/test_diffusion_autoopt_parity.py::test_legacy_sequence_still_matches_fixture E AssertionError: {'image|chroma|default|bfloat16|offload=0|gguf=0': {'before': {'applied': [['compiled', 'cuda_graph', 'cudnn_benchmark', 'fp16_accum']], ... ``` Bisected on main: `7d0c0952a0` (#16762, "TF32 matmuls on the default speed tier, not only max") is the first failing commit; its parent passes. #16762 added `tf32` to the default tier and regenerated `fixtures/diffusion_autoopt_parity.json`, but its branch predates #16710, which added the Anima and Chroma families. Those 16 rows (2 families x 2 dtypes x offload x GGUF on the default tier) kept their pre-#16762 values, so both parity tests now see them change. The code is right; the fixture is stale for the two families that landed in between. ## Change `studio/backend/tests/fixtures/diffusion_autoopt_parity.json` only. The 16 `image|anima|default|...` and `image|chroma|default|...` rows are rewritten from the current resolver, in the file's existing one-row-per-line format. In every one of them the only change is `tf32` appended to `applied`, the same change #16762 made to the other families' default-tier rows. No other row moves, and both `autoopt_entry` and `legacy_entry` produce the new rows. ## Testing - `tests/test_diffusion_autoopt_parity.py` and `tests/test_diffusion_speed.py`: main 2 failed; this branch 236 passed. - `7d0c0952a0~1`: the two parity tests pass; `7d0c0952a0`: they fail, which is the bisect above. - A script check over the diff: 16 rows changed, and in each the only difference is `tf32` added to `applied`.
…mage (unslothai#16711) Stacked on unslothai#16710, which adds the Anima family and MOSS-Image single files; merge that first. Most community LoRAs for Anima, Krea 2 and MOSS-Image are written for ComfyUI's loader and failed in Studio: - Krea 2's ComfyUI int8 / fp8 files compile at load, so every LoRA was refused ("Speed compiled this model, so LoRAs are off"), and reloading compiled again. - Anima files with kohya `.alpha` keys failed in diffusers' converter, and an `llm_adapter.embed` LoRA was left on the meta device, crashing the first render. - LyCORIS LoKR (`lokr_w1` / `lokr_w2`), the format of several of the most downloaded Krea 2 and MOSS-Image LoRAs, had no loader. - MOSS-Image had no LoRA loader. ## Changes - `diffusion_lora_files.py` (new) normalizes ComfyUI / kohya files for these three families before they reach diffusers. It folds `.alpha` into `lora_B` (alpha / rank, as ComfyUI does), renames `lora_down` / `lora_up`, maps Anima's embed pair to PEFT's embedding LoRA, and splits MOSS-Image's fused `qkv`. Other families keep diffusers' own reading. - LoKR modules run through a `KronLinear` wrapper that adds `scale * x @ kron(w1, w2).T` with two small matmuls, never building the dense delta. Factor scaling follows ComfyUI's `LokrAdapter`. - It is a wrapper rather than a forward hook because MOSS-Image's compiled forward dropped hooks. - The scale is a device tensor written in place, so a LoKR strength change keeps the compiled code and CUDA graphs. - Attaching or removing one rebuilds the group offload hooks, as diffusers' PEFT loader does, so the factors stream with their block. - `load_adapter` / `set_adapter_weights` / `unload_adapters` replace the diffusers calls in `diffusion.py`, so LoRA and LoKR adapters share one set of names and can sit on the same layer. - On ComfyUI-quantized files, LoRAs named at load attach before the compile, as Studio's own int8 / fp8 builds already bake them. Strength changes need no reload; a different adapter set does. - MOSS-Image's transformer gains `PeftAdapterMixin`, and its pipeline gains the LoRA methods. ## Limitations - LoKR covers Linear layers of these three families. Other families, and LoKR convolutions (`lokr_t2`), are refused with a message. - Adapters cost more per image than in ComfyUI, which patches them into the weights. Per 1024² image on an RTX 6000 Ada: | Case | Studio | ComfyUI | |---|---|---| | Krea 2 LoRA / LoKR on a ComfyUI fp8 file | 18 to 27 s | about 9 s | | Anima turbo LoRAs | 2.3 and 4.5 s | 2 and 4 s | | Anima style LoRA | 17 to 20 s | 13.5 s | | MOSS-Image 4-step LoRA | 1.7 s | 1.5 s | | MOSS-Image LoKR | 15 to 17 s | 11 s | - When the transformer streams through group offload, renders after an adapter is added or removed are about 2x slower and differ slightly (6.8 / 255 per pixel) from the first bare render. A plain LoRA through diffusers' own loader gives the same numbers, so this predates the PR and is not addressed here. ## Verification - Against ComfyUI v0.44.0, 3 prompts × 3 seeds with the creators' settings, on `Comfy-Org/Krea-2`, `Comfy-Org/MOSS-Image`, `circlestone-labs/Anima` and community fine-tunes. Adapters: the official Anima turbo LoRA (`circlestone-labs/Anima-Official-LoRAs`), plus community LoRAs and LoKRs from the monthly most-downloaded lists (a `.alpha` file, an embedding pair, `lora_down` / `lora_up`, a fused `qkv` LoKR). - All generate; none did before. - Each adapter changes the image by a similar amount in both tools (mean |diff| per pixel against no adapter, ComfyUI / Studio): Krea 2 LoKR 43.3 / 44.3, Krea 2 LoRA 41.7 / 35.5, Anima style 48.5 / 43.8, MOSS-Image LoKR 33.4 / 23.7. - The turbo LoRAs give sharp images at CFG 1 in 4 (MOSS-Image), 8 (Anima) and 12 (Anima 2.9B) steps. - The first PR's 22 checkpoints plus these adapter and encoder cases: 32 of 32 load, 96 images. This run and the ComfyUI comparison used this branch's first commit. - With the follow-up commits, a strength change through `/images/generate` without a reload changes the image (19.6 to 42.3 per pixel between weights 1 and 0) and repeats exactly (0.0). The same holds for Krea 2 streamed through group offload on an RTX 3090, with a LoKR and a LoRA together. - Full diffusion test suite: 18849 passed. Of the 6 failures, 4 fail the same way on main. The other 2, in `test_diffusion_native_quant.py`, pass alone; they fail after any real PEFT injection in the same worker, because peft caches `is_torchao_available()`. `test_diffusion_peft_torchao_guard.py` triggers the same failures without this PR. ## Screenshots Left three columns are ComfyUI, right three are this branch: same files, adapters, prompts and seeds.   --------- Co-authored-by: Daniel Han <[email protected]>
) #16710 added the `chroma` and `anima` families to the backend registry without frontend labels, so `tests/family-override.test.ts` ("every backend family has a label") fails on `main`, which turns the Studio frontend unit test job red for every PR: ``` + [ [ 'chroma', 'chroma' ], [ 'anima', 'anima' ] ] - [] ``` This adds the two labels, so the family picker shows "Chroma" and "Anima" instead of the raw keys. No other change. `node --experimental-strip-types --test tests/family-override.test.ts`: 7 of 7 pass (the failing case above passes).
…s are added (#16856) ## Summary From 21:00 UTC yesterday until #16809 merged, `Frontend unit tests (Windows)` and `Frontend build + bundle sanity` failed on every frontend PR (#16826, #16829, #16831, #16839, #16854 and others) with the same test: ``` not ok 4712 - family options follow the backend registry, deduplicated, and every backend family has a label location: 'studio/frontend/tests/family-override.test.ts:54:1' + [ [ 'chroma', 'chroma' ], [ 'anima', 'anima' ] ] - [] ``` #16710 added the `chroma` and `anima` image families to the backend registry. That part is fine, and #16809 added the missing picker labels. The test caught it correctly, but on the wrong PR: it reads `diffusion_families.py` and `video_families.py`, yet only Frontend CI runs it, and Frontend CI only triggers on `studio/frontend/**`. So the backend-only PR that added the families never ran it and merged green, and the next frontend PR inherited the failure. ## Change `studio/backend/tests/test_family_override_labels.py`, a new test only. It takes every family name from `diffusion_families._FAMILIES` and `video_families._FAMILIES`, reads the keys of `LABELS` in `family-override.ts`, and fails if a family has no label, naming the missing ones. Backend CI triggers on `studio/**`, so the PR that adds a family now has to add its label too. A second small test pins the `LABELS` parser on quoted (`"flux.1":`) and bare (`sdxl:`) keys, so a reformatted table cannot quietly read as empty. Running Frontend CI on every family registry change would also work, but those files change many times a day and the frontend jobs include Windows and macOS legs. One backend test costs under a second. No product code changes, and the frontend test stays as it is. ## Testing - On main (with #16809): 2 passed. - Deleting `chroma: "Chroma"` from `LABELS` again: fails with `add these families to LABELS in family-override.ts: ['chroma']`. - The file sorts into the existing `a-f` backend shard by glob. `tests/test_ci_backend_pytest_shards.py`: 26 passed.
…thai#16872) Chroma1-HD's ComfyUI fp8 file (`Comfy-Org/Chroma1-HD` `Chroma1-HD-fp8mixed`) ran 1.85x slower per step in Studio than in ComfyUI. unslothai#16710 denied every activation-quantizing scheme for Chroma, so Studio widened the file's fp8 layers to bf16. ComfyUI computes them in fp8. RTX 6000 Ada, 1024², 26 steps, CFG 3.5 (two passes per step), lower is better: | | Before (main) | After (this PR) | ComfyUI v0.44.0 | |---|---|---|---| | Seconds per step | 1.65 | 0.94 | 0.89 | | Seconds per image | 42.9 | 24.7 | 24.2 | The deny rested on two observations: - fp8 compute moved renders away from a bf16 diffusers render (16 / 255 per pixel against 3.5 without it). ComfyUI computes these layers in fp8 too, and 6 renders side by side with this branch's show no quality difference. - The "letterboxing" was a dark band along the left edge on 2 of 6 seeds. The same band appears on the same seeds in the bf16 diffusers reference and in Studio with fp8 denied, so it is not specific to fp8. ## Change Chroma's profile now denies only nvfp4 and mxfp8; fp8 and int8 move to `auto_scheme_skip`: - A ComfyUI fp8 file's layers take Studio's fp8 runtime (the file route requests fp8 explicitly). - Auto never quantizes bf16 or GGUF Chroma weights, which ComfyUI runs unquantized. A Q4_K_M GGUF still loads with `transformer_quant=off(auto)`. - An explicit fp8 or int8 request is honoured. ## Verification - The table above, against ComfyUI on the same file. - 3 prompts x 2 seeds on this branch and in ComfyUI: no artifacts, comparable renders. - `silveroxides/Chroma1-HD-GGUF` Q4_K_M: loads with `transformer_quant=off(auto)`, as before. - New test: the fp8 file's layers take the fp8 runtime through the real selector, auto skips fp8 and int8 on every tier, an explicit int8 request is kept, nvfp4 and mxfp8 stay denied. It fails on main. - Full diffusion, MOSS-Image and LoRA test files (`pytest -n 8`, 19,100+ tests): the only failures are the same 27 that fail on main with the same command (environment-dependent PyAV and attention-kernel tests, and tests that only fail when xdist puts them in one worker). - The family data snapshot drops fp8 and int8 from Chroma's deny list. --------- Co-authored-by: Daniel Han <[email protected]>
Studio refused several image models that ComfyUI loads from a single file, both the Comfy-Org repacks and community fine-tunes of them. This PR loads Anima, Chroma1-HD, MOSS-Image
.safetensorssingle files and Krea 2 int4 files, and accepts ComfyUI's separate text encoder and VAE files for Krea 2 and MOSS-Image.Changes
diffusion_anima.py). diffusers ships Anima only as modular blocks, soAnimaPipelinewrapsAnimaAutoBlocksbehind the classic pipeline interface, asdiffusion_flux3does for FLUX.3. A ComfyUI file holds both the Cosmos DiT and the LLM adapter: the loader splits them intoCosmosTransformer3DModelandAnimaTextConditioner, readsnum_layersfrom the file (so the 40-block 2.9B expansion loads), and takes the other components fromcirclestone-labs/Anima-Base-v1.0-Diffusers. Anima has no GGUF loader, so a new family flag,gguf_loadable = False, keeps its GGUFs out of the picker and refuses them at load.ChromaPipelineonlodestones/Chroma1-HDwith ComfyUI's template defaults (26 steps, CFG 3.5, shift 1, beta schedule). The beta schedule uses a new image-family field,scheduler_overrides, which video families already had. Activation-quantizing schemes are denied for Chroma (scheme_deny): with fp8 or int8 at runtime the same seed drifted from a plain diffusers render, and some fp8 renders came out letterboxed.load_krea2_pipelineaccepts a supplied VAE, so ComfyUI'sqwen_image_vae.safetensorsworks. Its int4 files use ComfyUI'sconvrot_w4a4layout, whichscan_comfy_quantrefused; those layers are now unpacked to int8 ConvRot and run on the existing fused int8 GEMM..safetensorssingle files load on the diffusers engine (GGUF stays on sd.cpp) and appear in the picker. A converter splits ComfyUI's fusedproj.qkvand rebuildsrope.bandswhen a file lacks it. Quant declarations without themodel.diffusion_model.prefix are matched to their weights, as ComfyUI does. Suppliedtext_encoder_file/vae_fileare accepted, and a Qwen3.5 encoder file is no longer misread as Qwen2.5-VL.Limitations
convrot_w4a4layers run with int8 activations; ComfyUI uses int4.ChromaTransformer2DModel: about 48 to 56 s per 1024² image on an RTX 6000 Ada for the fp8 file, against about 30 s in ComfyUI.asym_w4a8_int8text encoders (the MOSS-Image template'sqwen3.5_9b_w4a8_gptq; the bf16 and int8 ConvRot encoders load).Verification
Qwen3_5Model+AutoencoderKLFlux2. The encoder changes the images by a similar amount in both tools (mean |diff| per pixel 20.9 in ComfyUI, 17.4 in Studio).dequantize_convrot_w4a4_weightexactly.Screenshots
Left three columns are ComfyUI, right three are this branch: same files, prompts and seeds.