fix(krea2): align cfg with standard convention

Switch to neg-anchored guidance gated on > 1 so cfg 1.0 means no CFG, matching SD3/SDXL/Flux. Default guidance_scale 1.0; reference cfg Turbo 1.0, Base 4.5.
This commit is contained in:
CalamitousFelicitousness
2026-06-27 22:25:54 +01:00
parent 7b42f25cf7
commit e0b975810c
4 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -175,7 +175,7 @@
"path": "CalamitousFelicitousness/Krea-2-Base-Diffusers",
"preview": "CalamitousFelicitousness--Krea-2-Base-Diffusers.jpg",
"desc": "Krea 2 (K2) Base is the undistilled foundation model of the Krea 2 family, trained from scratch by Krea. A 12.9B-parameter single-stream flow-matching DiT that uses a Qwen3-VL-4B vision-language model as its text encoder and the Qwen-Image VAE. The base checkpoint is intended for fine-tuning and LoRA training; LoRAs trained on it apply to Krea 2 Turbo.",
"extras": "sampler: Default, cfg_scale: 3.5, steps: 52, width: 1024, height: 1024",
"extras": "sampler: Default, cfg_scale: 4.5, steps: 52, width: 1024, height: 1024",
"size": 34.0,
"date": "2026 June"
},
+1 -1
View File
@@ -11,7 +11,7 @@
"path": "CalamitousFelicitousness/Krea-2-Turbo-Diffusers",
"preview": "CalamitousFelicitousness--Krea-2-Turbo-Diffusers.jpg",
"desc": "Krea 2 (K2) Turbo is the 8-step distilled inference model of the Krea 2 family, trained from scratch by Krea. A 12.9B-parameter single-stream flow-matching DiT that uses a Qwen3-VL-4B vision-language model as its text encoder and the Qwen-Image VAE. Runs without classifier-free guidance; LoRAs trained on Krea 2 Base apply directly.",
"extras": "sampler: Default, cfg_scale: 0.0, steps: 8, width: 1024, height: 1024",
"extras": "sampler: Default, cfg_scale: 1.0, steps: 8, width: 1024, height: 1024",
"size": 34.0,
"date": "2026 June"
},
+2 -2
View File
@@ -222,7 +222,7 @@
"path": "vladmandic/Krea-2-Turbo-sdnq-hadamard-uint4",
"preview": "CalamitousFelicitousness--Krea-2-Turbo-Diffusers.jpg",
"desc": "Krea 2 (K2) Turbo is the 8-step distilled inference model of the Krea 2 family, trained from scratch by Krea. A 12.9B-parameter single-stream flow-matching DiT that uses a Qwen3-VL-4B vision-language model as its text encoder and the Qwen-Image VAE. Runs without classifier-free guidance; LoRAs trained on Krea 2 Base apply directly.",
"extras": "sampler: Default, cfg_scale: 0.0, steps: 8, width: 1024, height: 1024",
"extras": "sampler: Default, cfg_scale: 1.0, steps: 8, width: 1024, height: 1024",
"size": 34.0,
"date": "2026 June"
},
@@ -230,7 +230,7 @@
"path": "vladmandic/Krea-2-Base-sdnq-hadamard-uint4",
"preview": "CalamitousFelicitousness--Krea-2-Base-Diffusers.jpg",
"desc": "Krea 2 (K2) Base is the undistilled foundation model of the Krea 2 family, trained from scratch by Krea. A 12.9B-parameter single-stream flow-matching DiT that uses a Qwen3-VL-4B vision-language model as its text encoder and the Qwen-Image VAE. The base checkpoint is intended for fine-tuning and LoRA training; LoRAs trained on it apply to Krea 2 Turbo.",
"extras": "sampler: Default, cfg_scale: 3.5, steps: 52, width: 1024, height: 1024",
"extras": "sampler: Default, cfg_scale: 4.5, steps: 52, width: 1024, height: 1024",
"size": 34.0,
"date": "2026 June"
}
+3 -3
View File
@@ -154,7 +154,7 @@ class Krea2Pipeline(DiffusionPipeline, FromSingleFileMixin):
height: int = 1024,
width: int = 1024,
num_inference_steps: int = 28,
guidance_scale: float = 4.5,
guidance_scale: float = 1.0,
num_images_per_prompt: int = 1,
generator: torch.Generator | list[torch.Generator] | None = None,
latents: torch.Tensor | None = None,
@@ -177,7 +177,7 @@ class Krea2Pipeline(DiffusionPipeline, FromSingleFileMixin):
self._interrupt = False
is_distilled = bool(getattr(self.transformer.config, "is_distilled", False))
do_cfg = guidance_scale is not None and guidance_scale > 0 and not is_distilled
do_cfg = guidance_scale is not None and guidance_scale > 1 and not is_distilled
text, text_mask = self.encode_prompt(prompts, device)
text = text.to(dtype)
@@ -237,7 +237,7 @@ class Krea2Pipeline(DiffusionPipeline, FromSingleFileMixin):
hidden_states=img, encoder_hidden_states=uncond, timestep=model_t,
position_ids=uncond_pos, attention_mask=uncond_full_mask, return_dict=False,
)[0]
velocity = cond + guidance_scale * (cond - neg)
velocity = neg + guidance_scale * (cond - neg)
else:
velocity = cond
img = self.scheduler.step(velocity, t, img, return_dict=False)[0]