Add FLUX.1 Krea dev to the image model catalog

Krea's guidance-distilled FLUX.1-dev finetune keeps the exact dev layout, so it
runs under the existing flux.1 family unchanged. Wire it up end to end:

- Catalog group with the gated official bf16 pipeline and the open QuantStack
  GGUF quants; the gated artifact is skipped on auto-routing when undownloaded.
- Trust the official repo for non-GGUF from_pretrained loads, next to the other
  black-forest-labs bases.
- Generation defaults: 28 steps at guidance 4.5 per the model card. The generic
  "krea" defaults key (Krea-2-Turbo's 8-step no-CFG recipe) used to swallow the
  id, which would have produced garbage output; the new flux.1-krea key precedes
  it on both the backend table and the images page table.
- The flux.1 prequant checkpoints are schnell-based; the loader's baked
  base_model_id validation refuses them for the Krea-dev base, so int8/fp8
  requests dense-quantize instead (covered by existing prequant tests).
This commit is contained in:
Daniel Han 2026-07-17 10:49:04 +00:00
commit 08b853df15
6 changed files with 69 additions and 0 deletions

View file

@ -284,6 +284,9 @@ _TRUSTED_NON_GGUF_REPOS = frozenset(
"black-forest-labs/flux.1-dev",
"black-forest-labs/flux.1-schnell",
"black-forest-labs/flux.1-kontext-dev",
# Krea's guidance-distilled FLUX.1-dev finetune: same arch/layout as dev (FluxPipeline,
# CLIP+T5+ae), gated like dev. Detected as the flux.1 family via the "flux.1" token.
"black-forest-labs/flux.1-krea-dev",
"tongyi-mai/z-image-turbo",
"qwen/qwen-image",
"qwen/qwen-image-2512",

View file

@ -454,6 +454,10 @@ def resolve_base_repo(fam: DiffusionFamily, base_repo: Optional[str]) -> str:
# first -- same values as the UI's MODEL_DEFAULTS table (images-page.tsx); keep in sync.
_GENERATION_DEFAULTS: tuple[tuple[str, int, float], ...] = (
("z-image-turbo", 9, 0.0),
# FLUX.1 Krea dev is a FLUX.1-dev finetune (flux.1 family), NOT a Krea-2: its card runs
# 28 steps at guidance 4.5. Must precede the generic "krea" key below, which would
# otherwise hand it Krea-2-Turbo's 8-step no-CFG recipe.
("flux.1-krea", 28, 4.5),
# Krea 2 Raw (undistilled): 52 steps / guidance 3.5. Must precede the generic "krea" key.
("krea-2-raw", 52, 3.5),
# Krea 2 Turbo (distilled): 8 steps, no CFG. "krea" then covers Turbo and other krea ids but Raw.

View file

@ -53,6 +53,38 @@ def test_ideogram4_repos_are_trusted_non_gguf():
assert not _is_trusted_diffusion_repo("ideogram-ai/some-future-repo")
# ── FLUX.1 Krea dev (flux.1 family variant) ──────────────────────────────────
@pytest.mark.parametrize(
"repo_id",
[
"black-forest-labs/FLUX.1-Krea-dev",
"QuantStack/FLUX.1-Krea-dev-GGUF",
# A local GGUF pick where the family keyword lives in the filename.
"QuantStack/FLUX.1-Krea-dev-GGUF/flux1-krea-dev-Q4_K_M.gguf",
],
)
def test_detect_family_flux1_krea_dev(repo_id):
# Krea's FLUX.1-dev finetune keeps the exact dev layout, so it must resolve to the
# existing flux.1 family (FluxPipeline), never to krea-2 (a different arch).
fam = detect_family(repo_id)
assert fam is not None and fam.name == "flux.1"
assert fam.pipeline_class == "FluxPipeline"
def test_flux1_krea_dev_is_trusted_non_gguf():
# The gated official pipeline loads via from_pretrained -> needs the allowlist.
assert _is_trusted_diffusion_repo("black-forest-labs/FLUX.1-Krea-dev")
def test_flux1_krea_dev_generation_defaults():
# Model-card recipe: 28 steps at guidance 4.5. The generic "krea" key (Krea-2-Turbo's
# 8-step no-CFG shape) must NOT swallow it, and the krea-2 defaults must stay intact.
assert default_generation_params("black-forest-labs/FLUX.1-Krea-dev") == (28, 4.5)
assert default_generation_params("QuantStack/FLUX.1-Krea-dev-GGUF") == (28, 4.5)
assert default_generation_params("krea/Krea-2-Turbo") == (8, 0.0)
assert default_generation_params("krea/Krea-2-Raw") == (52, 3.5)
def test_ideogram4_generation_defaults():
# Model-card settings: 48 steps, guidance 7 (the backend keeps the pipeline's
# recommended tapered schedule when the request matches exactly).