diff --git a/studio/backend/core/inference/diffusion_families.py b/studio/backend/core/inference/diffusion_families.py index 53792feac2..a6cf3d7b03 100644 --- a/studio/backend/core/inference/diffusion_families.py +++ b/studio/backend/core/inference/diffusion_families.py @@ -461,9 +461,13 @@ def resolve_base_repo(fam: DiffusionFamily, base_repo: Optional[str]) -> str: # (studio/frontend/src/features/images/images-page.tsx); keep the two in sync. _GENERATION_DEFAULTS: tuple[tuple[str, int, float], ...] = ( ("z-image-turbo", 9, 0.0), - # Krea 2 Turbo is distilled (TDM): 8 steps, no CFG -- matching the Create UI seed, so - # the OpenAI /v1/images/generations route uses the documented recipe instead of falling - # through to the generic (9, 0.0). "krea" collides with no other model id. + # Krea 2 Raw is the undistilled base (both Turbo and Raw are in _TRUSTED_NON_GGUF_REPOS, so + # either is inference-loadable): its model card runs 52 steps at guidance 3.5. It must precede + # the generic "krea" key, or the distilled recipe below would degrade a Raw load to garbage. + ("krea-2-raw", 52, 3.5), + # Krea 2 Turbo is distilled (TDM): 8 steps, no CFG -- matching the Create UI seed, so the + # OpenAI /v1/images/generations route uses the documented recipe instead of falling through + # to the generic (9, 0.0). "krea" then covers Turbo and any other krea id but Raw (above). ("krea", 8, 0.0), ("flux.1-schnell", 4, 0.0), # Kontext (editing) before the generic flux.1: ~28 steps, lower guidance (~2.5). diff --git a/studio/backend/tests/test_diffusion_krea2.py b/studio/backend/tests/test_diffusion_krea2.py index b17be7e38a..86ff8fdcb0 100644 --- a/studio/backend/tests/test_diffusion_krea2.py +++ b/studio/backend/tests/test_diffusion_krea2.py @@ -155,9 +155,10 @@ def test_krea2_family_wiring(): assert fam.deploy_base_repo == "krea/Krea-2-Turbo" # The OpenAI /v1/images/generations route reads (steps, guidance) from this table; Krea # Turbo is distilled (8 steps, no CFG), matching the Create UI seed instead of the - # generic (9, 0.0) fallback. + # generic (9, 0.0) fallback. Raw is the undistilled base (also inference-loadable) and runs + # its full 52-step / CFG 3.5 recipe, so its more specific key must win over the "krea" one. assert default_generation_params("krea/Krea-2-Turbo") == (8, 0.0) - assert default_generation_params("krea/Krea-2-Raw") == (8, 0.0) + assert default_generation_params("krea/Krea-2-Raw") == (52, 3.5) # ── training wiring ────────────────────────────────────────────────────────── diff --git a/studio/frontend/src/features/images/images-page.tsx b/studio/frontend/src/features/images/images-page.tsx index 92379f1ddb..800ba0a0d9 100644 --- a/studio/frontend/src/features/images/images-page.tsx +++ b/studio/frontend/src/features/images/images-page.tsx @@ -211,8 +211,12 @@ const DEFAULT_GEN = { steps: 9, guidance: 0 }; const MODEL_DEFAULTS: Array<{ match: string; steps: number; guidance: number }> = [ { match: "z-image-turbo", steps: 9, guidance: 0 }, - // Krea 2 Turbo is distilled (TDM): 8 steps, no CFG (the base/midtrain checkpoints - // would want ~28 steps + CFG 4.5, but only Turbo is curated today). + // Krea 2 Raw is the undistilled base (also inference-loadable): its card runs 52 steps at + // guidance 3.5, so it must precede the distilled "krea-2" key below or a Raw load would run + // the 8-step recipe and produce garbage. + { match: "krea-2-raw", steps: 52, guidance: 3.5 }, + // Krea 2 Turbo is distilled (TDM): 8 steps, no CFG. "krea-2" then covers Turbo (and any + // other krea id) but Raw, which is matched more specifically above. { match: "krea-2", steps: 8, guidance: 0 }, { match: "flux.1-schnell", steps: 4, guidance: 0 }, // Kontext (editing) before the generic flux.1: ~28 steps, lower guidance (~2.5).