Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: load the hosted FP8 checkpoints for FLUX.1-dev, FLUX.2-klein-4B, FLUX.2-dev and Qwen-Image-2512, and seed Krea 2 (#12649)
Daniel Hanc03a5e0d0f0a
diff --git a/studio/backend/core/inference/diffusion.py b/studio/backend/core/inference/diffusion.pyindex 8b9803cc542..308e62b56c4 100644--- a/studio/backend/core/inference/diffusion.py+++ b/studio/backend/core/inference/diffusion.py@@ -6290,32 +6290,7 @@ class DiffusionBackend:if pipe is None:if kind == "pipeline":- if fam.name == KREA2_FAMILY_NAME:- # krea ships transformers-5.x configs the 4.x line cannot parse, so assemble- # per-component; that path never sees pipe_kwargs, so pass the pre-cast TE. Fetches EVERY- # component from the id given, so it must get the mirror.- pipe = load_krea2_pipeline(- fetch_base,- dtype,- hf_token = hf_token,- check_cancelled = lambda: self._raise_if_load_cancelled(- _load_token- ),- # The branch never sees pipe_kwargs, so the one keyword that keeps the no-download- # promise has to be handed over with the rest- local_files_only = local_files_only,- text_encoder = te_prequant_pipe_kwargs(- fam,- fetch_base,- te_quant_mode = text_encoder_quant,- target = target,- dtype = dtype,- hf_token = hf_token,- logger = logger,- local_files_only = local_files_only,- ).get("text_encoder"),- )- elif fam.name == IDEOGRAM4_FAMILY_NAME:+ if fam.name == IDEOGRAM4_FAMILY_NAME:# ideogram ships the same transformers-5.x Qwen stack as krea; assemble per-component too,# from the mirror for the same reason.pipe = load_ideogram4_pipeline(@@ -6460,26 +6435,45 @@ class DiffusionBackend:)bf16_pipeline_plan = planself._raise_if_load_cancelled(_load_token)- # bf16 -> fp16 conversion materialises in host RAM (35 GB for FLUX.1)- small_host = self._small_host_decision(- _base_local_dir or fetch_base,- pipe_kwargs,- target,- dtype,- lora_active = _has_active_lora(loras),- )- if small_host is not None and small_host.engaged:- pipe_kwargs["torch_dtype"] = small_host_torch_dtype_map(- small_host, dtype- )- # The prefetched snapshot dir keeps from_pretrained off the hub (24 GB per FLUX.1- # otherwise)- try:- pipe = pipeline_cls.from_pretrained(- _base_local_dir or fetch_base, **pipe_kwargs+ small_host = None+ if fam.name == KREA2_FAMILY_NAME:+ # krea's transformers-5.x configs break the 4.x line: assemble per component from+ # pipe_kwargs (pre-cast TE, seeded denoiser or None = dense shards).+ try:+ pipe = load_krea2_pipeline(+ fetch_base,+ dtype,+ hf_token = hf_token,+ check_cancelled = lambda: self._raise_if_load_cancelled(+ _load_token+ ),+ local_files_only = local_files_only,+ text_encoder = pipe_kwargs.get("text_encoder"),+ transformer = pipe_kwargs.get("transformer"),+ )+ finally:+ self._stop_load_prefetch()+ else:+ # bf16 -> fp16 conversion materialises in host RAM (35 GB for FLUX.1)+ small_host = self._small_host_decision(+ _base_local_dir or fetch_base,+ pipe_kwargs,+ target,+ dtype,+ lora_active = _has_active_lora(loras),)- finally:- self._stop_load_prefetch()+ if small_host is not None and small_host.engaged:+ pipe_kwargs["torch_dtype"] = small_host_torch_dtype_map(+ small_host, dtype+ )+ # The prefetched snapshot dir keeps from_pretrained off the hub (24 GB per FLUX.1+ # otherwise)+ try:+ pipe = pipeline_cls.from_pretrained(+ _base_local_dir or fetch_base, **pipe_kwargs+ )+ finally:+ self._stop_load_prefetch()if small_host is not None and small_host.engaged:plan = self._apply_small_host_route(pipe,diff --git a/studio/backend/core/inference/diffusion_denoiser_prequant.py b/studio/backend/core/inference/diffusion_denoiser_prequant.pyindex a598a6a5b01..0f9f604d821 100644--- a/studio/backend/core/inference/diffusion_denoiser_prequant.py+++ b/studio/backend/core/inference/diffusion_denoiser_prequant.py@@ -12,7 +12,6 @@ from __future__ import annotationsfrom typing import Any, Optionalfrom .diffusion_families import IDEOGRAM4_FAMILY_NAME-from .diffusion_krea2 import KREA2_FAMILY_NAME# The planner DECIDED against the seed, unlike never having asked: the pull kept the dense shards, so# the loader must not re-take the decision and fetch the artifact inline.@@ -20,9 +19,8 @@ PIPELINE_SEED_DECLINED = "__declined__"DENOISER_COMPONENT = "transformer"-# Families assembled PER COMPONENT, plus ideogram's second denoiser: their assemblers never see-# ``pipe_kwargs``, so a seed would be dropped after the plan had dropped their dense shards.-_UNSEEDABLE_PIPELINE_FAMILIES = (KREA2_FAMILY_NAME, IDEOGRAM4_FAMILY_NAME)+# Ideogram's assembler never sees ``pipe_kwargs``, so a seed would be dropped after the plan dropped its dense shards.+_UNSEEDABLE_PIPELINE_FAMILIES = (IDEOGRAM4_FAMILY_NAME,)def pipeline_seed_supported(fam: Any) -> bool:diff --git a/studio/backend/core/inference/diffusion_families.py b/studio/backend/core/inference/diffusion_families.pyindex f18ee27df7b..68f57f2ee19 100644--- a/studio/backend/core/inference/diffusion_families.py+++ b/studio/backend/core/inference/diffusion_families.py@@ -550,6 +550,8 @@ _FAMILIES: tuple[DiffusionFamily, ...] = (("int8", "unsloth/Krea-2-Turbo-FP8"),("fp8", "unsloth/Krea-2-Turbo-FP8"),),+ # Both are baked from the distilled Turbo denoiser: Raw quantizes its own dense weights.+ prequant_excluded_bases = ("krea/krea-2-raw",),# Pre-cast Qwen3-VL-4B TE (8.88 -> 4.83 GB); handed into load_krea2_pipeline directly (assembly never sees# pipe_kwargs).te_prequant_repos = (("fp8", "text_encoder", "unsloth/Krea-2-Turbo-FP8"),),diff --git a/studio/backend/core/inference/diffusion_prequant.py b/studio/backend/core/inference/diffusion_prequant.pyindex 423ec583cd4..23ce425949b 100644--- a/studio/backend/core/inference/diffusion_prequant.py+++ b/studio/backend/core/inference/diffusion_prequant.py@@ -1206,6 +1206,7 @@ def load_prequantized_transformer(# The only check reading what the artifact HOLDS: corruption after build passes the rest.if not _verify_packed_fingerprint(state_dict, ckpt.get("metadata") or {}, logger = logger):return None+ _repair_legacy_checkpoint(ckpt, scheme, logger)_pin_kernel_preference(state_dict, logger)# Read from the root that actually supplied the checkpoint: after a mid-session cache change the pinned root@@ -1529,7 +1530,12 @@ def _load_transformer_config(_FLOAT8_TENSOR_CLASS = "Float8Tensor"-def _fp8_activation_floor_present(state_dict: Any, logger: Any) -> bool:+def _fp8_activation_floor_present(+ state_dict: Any,+ logger: Any,+ *,+ warn: bool = True,+) -> bool:"""True unless the first Float8Tensor has no activation lower bound (by class: NVFP4Tensor lacks one too)."""from .diffusion_transformer_quant import TQ_FP8@@ -1543,6 +1549,8 @@ def _fp8_activation_floor_present(state_dict: Any, logger: Any) -> bool:continueif getattr(kwargs, "hp_value_lb", None):return True+ if not warn:+ return False_warn(logger,TQ_FP8,@@ -1558,6 +1566,77 @@ def _fp8_activation_floor_present(state_dict: Any, logger: Any) -> bool:return True+def _fp8_kwargs_missing_floor(tensor: Any) -> Optional[Any]:+ if type(tensor).__name__ != _FLOAT8_TENSOR_CLASS:+ return None+ kwargs = getattr(tensor, "act_quant_kwargs", None)+ if kwargs is None or getattr(kwargs, "hp_value_lb", None):+ return None+ return kwargs+++def _fp8_activation_floor_restorable(state_dict: Any) -> bool:+ """Whether every unfloored Float8Tensor differs from the runtime config in the floor alone.++ torchao's fp8 weight quantiser never reads ``hp_value_lb``, so the weight bytes of an artifact built before+ ``activation_value_lb`` equal what ``_make_quant_config`` builds today."""+ try:+ items = state_dict.items() if hasattr(state_dict, "items") else ()+ for _name, tensor in items:+ kwargs = _fp8_kwargs_missing_floor(tensor)+ if kwargs is None:+ continue+ if (+ not hasattr(kwargs, "hp_value_lb")+ or getattr(kwargs, "hp_value_ub", None) is not None+ ):+ return False+ except Exception: # noqa: BLE001 -- cannot prove it: keep refusing+ return False+ return True+++def _restore_fp8_activation_floor(state_dict: Any, logger: Any = None) -> int:+ """Write the runtime activation floor into every unfloored Float8Tensor; returns how many.+ Fresh kwargs per tensor: a pickle may share one instance between tensors."""+ import copy+ import dataclasses++ from .diffusion_transformer_quant import FP8_ACTIVATION_VALUE_LB++ restored = 0+ for _name, tensor in list(state_dict.items()):+ kwargs = _fp8_kwargs_missing_floor(tensor)+ if kwargs is None:+ continue+ if dataclasses.is_dataclass(kwargs) and not isinstance(kwargs, type):+ fixed = dataclasses.replace(kwargs, hp_value_lb = FP8_ACTIVATION_VALUE_LB)+ else:+ fixed = copy.copy(kwargs)+ fixed.hp_value_lb = FP8_ACTIVATION_VALUE_LB+ tensor.act_quant_kwargs = fixed+ restored += 1+ if restored and logger is not None:+ logger.info(+ "diffusion.prequant: restored the fp8 activation scale floor (%g) on %d weights built "+ "before activation_value_lb",+ FP8_ACTIVATION_VALUE_LB,+ restored,+ )+ return restored+++def _repair_legacy_checkpoint(+ ckpt: Any,+ scheme: str,+ logger: Any = None,+) -> None:+ from .diffusion_nvfp4_policy import declares_policy+ from .diffusion_transformer_quant import TQ_FP8+ if scheme == TQ_FP8 or declares_policy(ckpt.get("metadata") or {}):+ _restore_fp8_activation_floor(ckpt["state_dict"], logger)++def _validate_activation_rotation(ckpt_format: Any, meta: Any, scheme: str, logger: Any) -> bool:"""Reject a checkpoint whose activation rotation this build cannot honour EXACTLY.@@ -1737,8 +1816,16 @@ def _validate_checkpoint(# act_quant_kwargs.hp_value_lb, so an artifact built before the fix stays broken however it is loaded, and it# predates any metadata field we could stamp -- and "absent is accepted for back-compat", the convention every# check above follows, is exactly wrong here. Reading the tensors is fail-closed and needs no format bump.- if holds_fp8 and not _fp8_activation_floor_present(ckpt.get("state_dict"), logger):- return False+ # Unless the floor is the only difference: it is not weight data, so ``_repair_legacy_checkpoint`` writes it in.+ if holds_fp8 and not _fp8_activation_floor_present(ckpt.get("state_dict"), logger, warn = False):+ if not _fp8_activation_floor_restorable(ckpt.get("state_dict")):+ _fp8_activation_floor_present(ckpt.get("state_dict"), logger)+ return False+ if logger is not None:+ logger.info(+ "diffusion.prequant: fp8 checkpoint predates activation_value_lb; the runtime "+ "floor will be written into its weights"+ )ckpt_base = meta.get("base_model_id")if base:# Keys matching a different base can load strict=True and generate from the wrong weights. Our builder alwaysdiff --git a/studio/backend/core/inference/diffusion_transformer_quant.py b/studio/backend/core/inference/diffusion_transformer_quant.pyindex 23596a1edd2..a30b9713d3c 100644--- a/studio/backend/core/inference/diffusion_transformer_quant.py+++ b/studio/backend/core/inference/diffusion_transformer_quant.py@@ -59,6 +59,9 @@ _REQUIRE_BF16_SCHEMES = (TQ_FP8, TQ_MXFP8)# metadata, so a stale per-TENSOR checkpoint is rejected and rebuilt.FP8_GRANULARITY = "per_row"+# torchao ``activation_value_lb``: keeps an all-zero activation row off scale 0 (NaN, black frames); not calibrated.+FP8_ACTIVATION_VALUE_LB = 1e-12+# Skip linears below this feature size: a small FLOP share, so leaving them bf16 costs ~nothing.DEFAULT_MIN_LINEAR_FEATURES = 512@@ -1765,7 +1768,7 @@ def _make_quant_config(scheme: str, fast_accum: Optional[bool] = None) -> Any:fp8_kwargs: dict = {"granularity": PerRow()}config_params = _inspect.signature(Float8DynamicActivationFloat8WeightConfig).parametersif "activation_value_lb" in config_params:- fp8_kwargs["activation_value_lb"] = 1e-12+ fp8_kwargs["activation_value_lb"] = FP8_ACTIVATION_VALUE_LB# Pin the plain-torch quantize kernel: the default AUTO switches to the MSLK kernel whenever an mslk package# is importable, changing fp8 scale rounding BITWISE and breaking the prequant bit-identity invariant. It is# also slower compiled on B200 (an opaque extern call blocks inductor's quantize fusion), so the pin costsdiff --git a/studio/backend/tests/test_diffusion_offload_precision.py b/studio/backend/tests/test_diffusion_offload_precision.pyindex e6fcf4e7143..a8a1fdbeeae 100644--- a/studio/backend/tests/test_diffusion_offload_precision.py+++ b/studio/backend/tests/test_diffusion_offload_precision.py@@ -474,12 +474,13 @@ def planner(monkeypatch):FAMILY_TABLE = {+ # Krea 2 seeds its hosted int8 denoiser like the generic pipeline families; same offload tiers as on the fly.("krea-2", "krea/Krea-2-Turbo"): {- 8: ("on-the-fly int8", OFFLOAD_STREAMING),- 12: ("on-the-fly int8", OFFLOAD_GROUP),- 16: ("on-the-fly int8", OFFLOAD_GROUP),- 24: ("on-the-fly int8", OFFLOAD_GROUP),- 32: ("on-the-fly int8", OFFLOAD_GROUP),+ 8: ("hosted int8", OFFLOAD_STREAMING),+ 12: ("hosted int8", OFFLOAD_GROUP),+ 16: ("hosted int8", OFFLOAD_GROUP),+ 24: ("hosted int8", OFFLOAD_GROUP),+ 32: ("hosted int8", OFFLOAD_GROUP),},("lumina-2", "Alpha-VLLM/Lumina-Image-2.0"): {8: ("hosted int8", OFFLOAD_STREAMING),diff --git a/studio/backend/tests/test_diffusion_prequant.py b/studio/backend/tests/test_diffusion_prequant.pyindex 0ec6df5f425..22730e1311f 100644--- a/studio/backend/tests/test_diffusion_prequant.py+++ b/studio/backend/tests/test_diffusion_prequant.py@@ -2170,12 +2170,8 @@ def test_load_is_dropped_when_the_padding_cannot_be_proven(monkeypatch, tmp_path# ── fp8 activation scale floor ──────────────────────────────────────────────────-def test_an_fp8_checkpoint_without_the_activation_floor_is_rejected():- # A checkpoint built before activation_value_lb bakes hp_value_lb=None into every quantised- # tensor, and stays broken however it is loaded: torchao's per-row activation quantiser divides- # by the row amax, so qwen's all-zero text rows give scale 0 and NaN. The metadata checks around- # this one all accept an absent field for back-compat, which is exactly wrong here, so the floor- # is read off the TENSORS instead. Measured: 412 of 512 rows non-finite without it, 0 with it.+def test_an_fp8_checkpoint_without_the_activation_floor_is_detected():+ # Pre-floor builds bake hp_value_lb=None (all-zero rows -> scale 0 -> NaN); read off the tensors, not metadata.floored = {"blocks.0.attn.to_q.weight": Float8Tensor(hp_value_lb = 1e-12)}unfloored = {"blocks.0.attn.to_q.weight": Float8Tensor(hp_value_lb = None)}assert pq._fp8_activation_floor_present(floored, None) is True@@ -2184,6 +2180,46 @@ def test_an_fp8_checkpoint_without_the_activation_floor_is_rejected():assert pq._fp8_activation_floor_present({"w": Float8Tensor(hp_value_lb = 0.0)}, None) is False+def test_an_fp8_checkpoint_without_the_floor_loads_with_the_runtime_floor(monkeypatch, tmp_path):+ # The floor is not weight data, so a pre-floor artifact holds the runtime path's exact weights.+ from core.inference.diffusion_transformer_quant import FP8_ACTIVATION_VALUE_LB++ ckpt = _good_ckpt(scheme = "fp8")+ shared = types.SimpleNamespace(hp_value_lb = None, hp_value_ub = None)+ first, second, floored = Float8Tensor(), Float8Tensor(), Float8Tensor(hp_value_lb = 1e-9)+ first.act_quant_kwargs = shared+ second.act_quant_kwargs = shared # a pickle may share one kwargs object between tensors+ ckpt["state_dict"] = {+ "a.weight": first,+ "b.weight": second,+ "c.weight": floored,+ "d.bias": object(),+ }+ out = _load(monkeypatch, tmp_path, ckpt, scheme = "fp8")+ assert out is not None+ # a repaired load is not a failure: nothing for the status line to report+ assert pq.last_prequant_failure() is None+ assert first.act_quant_kwargs.hp_value_lb == FP8_ACTIVATION_VALUE_LB+ assert second.act_quant_kwargs.hp_value_lb == FP8_ACTIVATION_VALUE_LB+ assert first.act_quant_kwargs is not second.act_quant_kwargs+ assert shared.hp_value_lb is None+ assert (+ floored.act_quant_kwargs.hp_value_lb == 1e-9+ ) # an artifact's own floor is never rewritten+++def test_an_fp8_checkpoint_differing_in_more_than_the_floor_stays_refused(monkeypatch, tmp_path):+ ckpt = _good_ckpt(scheme = "fp8")+ capped = Float8Tensor(hp_value_lb = None)+ capped.act_quant_kwargs.hp_value_ub = 1e4+ ckpt["state_dict"] = {"a.weight": capped}+ assert _load(monkeypatch, tmp_path, ckpt, scheme = "fp8") is None+ assert "no activation scale floor" in (pq.last_prequant_failure() or "")+ no_field = Float8Tensor()+ no_field.act_quant_kwargs = types.SimpleNamespace()+ assert pq._fp8_activation_floor_restorable({"a.weight": no_field}) is False++def test_the_floor_check_ignores_dense_and_unreadable_state_dicts():# A dense tensor carries no act_quant_kwargs, so it is not evidence of a missing floor; the# scheme / granularity checks own that case. Same for a state dict this cannot walk at all:@@ -2293,6 +2329,11 @@ def test_the_fp8_invariants_cover_the_fp8_half_of_a_policy_checkpoint():unfloored = dict(ckpt)unfloored["state_dict"] = dict(ckpt["state_dict"])unfloored["state_dict"]["layers.0.feed_forward.w1.weight"] = Float8Tensor(hp_value_lb = None)+ # The fp8 half without its floor is restorable (the load writes the runtime floor in), so it validates.+ assert pq._validate_checkpoint(unfloored, "nvfp4", base, logger) is True+ capped = Float8Tensor(hp_value_lb = None)+ capped.act_quant_kwargs.hp_value_ub = 1.0+ unfloored["state_dict"]["layers.0.feed_forward.w1.weight"] = cappedassert pq._validate_checkpoint(unfloored, "nvfp4", base, logger) is Falseper_tensor = dict(ckpt)per_tensor["metadata"] = _policy_meta()diff --git a/studio/backend/tests/test_diffusion_prequant_legacy_repair.py b/studio/backend/tests/test_diffusion_prequant_legacy_repair.pynew file mode 100644index 00000000000..c66354a0157--- /dev/null+++ b/studio/backend/tests/test_diffusion_prequant_legacy_repair.py@@ -0,0 +1,125 @@+# SPDX-License-Identifier: AGPL-3.0-only+# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++"""Legacy hosted pre-quant checkpoints load with the runtime's contract (real torchao, CPU)."""++from __future__ import annotations++import ast+import dataclasses+import os+import sys+from pathlib import Path++import pytest++_BACKEND = Path(__file__).resolve().parents[1]+if str(_BACKEND) not in sys.path:+ sys.path.insert(0, str(_BACKEND))++torch = pytest.importorskip("torch")+pytest.importorskip("torchao")++from core.inference import diffusion_prequant as pq # noqa: E402+++def _float8_kwargs_cls():+ try:+ from torchao.quantization.quantize_.workflows.float8.float8_tensor import (+ QuantizeTensorToFloat8Kwargs,+ )+ except Exception: # noqa: BLE001+ pytest.skip("this torchao has no QuantizeTensorToFloat8Kwargs")+ return QuantizeTensorToFloat8Kwargs+++def _legacy_fp8_weight():+ """A real Float8Tensor exactly as an artifact built before ``activation_value_lb`` holds it."""+ from torchao.quantization import PerRow+ from torchao.quantization.quantize_.workflows.float8.float8_tensor import Float8Tensor++ kwargs = _float8_kwargs_cls()(torch.float8_e4m3fn, PerRow())+ assert kwargs.hp_value_lb is None+ weight = torch.randn(64, 32, dtype = torch.bfloat16)+ return Float8Tensor.from_hp(weight, granularity = PerRow(), act_quant_kwargs = kwargs)+++def test_restored_floor_is_the_runtime_config_floor():+ from core.inference.diffusion_transformer_quant import (+ FP8_ACTIVATION_VALUE_LB,+ TQ_FP8,+ _make_quant_config,+ )++ config = _make_quant_config(TQ_FP8)+ if getattr(config, "activation_value_lb", None) is None:+ pytest.skip("this torchao has no activation_value_lb")+ assert config.activation_value_lb == FP8_ACTIVATION_VALUE_LB++ tensor = _legacy_fp8_weight()+ before = tensor.act_quant_kwargs+ qdata, scale = tensor.qdata.clone(), tensor.scale.clone()+ state_dict = {"blocks.0.attn.to_q.weight": tensor}+ assert pq._fp8_activation_floor_present(state_dict, None) is False+ assert pq._fp8_activation_floor_restorable(state_dict) is True+ assert pq._restore_fp8_activation_floor(state_dict) == 1+ after = tensor.act_quant_kwargs+ assert after == dataclasses.replace(before, hp_value_lb = config.activation_value_lb)+ assert torch.equal(tensor.qdata.view(torch.uint8), qdata.view(torch.uint8))+ assert torch.equal(tensor.scale, scale)+ assert pq._fp8_activation_floor_present(state_dict, None) is True+ assert pq._restore_fp8_activation_floor(state_dict) == 0+++def test_restored_floor_gives_a_zero_row_a_finite_scale():+ from torchao.quantization.quant_primitives import _choose_scale_float8++ tensor = _legacy_fp8_weight()+ zero_rows = torch.zeros(4, 32, dtype = torch.bfloat16)+ unfloored = _choose_scale_float8(+ zero_rows, [1, 32], torch.float8_e4m3fn, hp_value_lb = tensor.act_quant_kwargs.hp_value_lb+ )+ assert not bool((unfloored > 0).all()) # the black-frame failure: scale 0 for an all-zero row+ pq._restore_fp8_activation_floor({"w": tensor})+ floored = _choose_scale_float8(+ zero_rows, [1, 32], torch.float8_e4m3fn, hp_value_lb = tensor.act_quant_kwargs.hp_value_lb+ )+ assert bool((floored > 0).all()) and bool(torch.isfinite(floored).all())+ assert bool(torch.isfinite(zero_rows.float() / floored.reshape(-1, 1)).all())+++def test_krea2_pipeline_picks_seed_their_hosted_denoiser():+ from core.inference.diffusion_denoiser_prequant import pipeline_seed_supported+ from core.inference.diffusion_families import IDEOGRAM4_FAMILY_NAME, detect_family++ krea = detect_family("krea/Krea-2-Turbo")+ assert krea is not None and dict(krea.prequant_repos) # hosted int8 / fp8 artifacts exist+ assert pipeline_seed_supported(krea) is True+ from core.inference.diffusion_families import family_prequant_repo++ for raw in ("krea/Krea-2-Raw", "unsloth/Krea-2-Raw"):+ assert family_prequant_repo(krea, "fp8", base_repo = raw) is None+ assert family_prequant_repo(krea, "int8", base_repo = raw) is None+ assert (+ family_prequant_repo(krea, "fp8", base_repo = "krea/Krea-2-Turbo")+ == "unsloth/Krea-2-Turbo-FP8"+ )+ ideogram = type("Fam", (), {"name": IDEOGRAM4_FAMILY_NAME})()+ assert pipeline_seed_supported(ideogram) is False+++def _krea_pipeline_calls() -> list:+ source = (_BACKEND / "core" / "inference" / "diffusion.py").read_text(encoding = "utf-8")+ calls = []+ for node in ast.walk(ast.parse(source)):+ if isinstance(node, ast.Call) and getattr(node.func, "id", None) == "load_krea2_pipeline":+ calls.append({kw.arg: ast.unparse(kw.value) for kw in node.keywords})+ return calls+++def test_the_krea2_pipeline_assembly_takes_the_seeded_denoiser():+ calls = _krea_pipeline_calls()+ seeded = [c for c in calls if c.get("transformer") == "pipe_kwargs.get('transformer')"]+ assert len(seeded) == 1+ assert seeded[0].get("text_encoder") == "pipe_kwargs.get('text_encoder')"+ assert seeded[0].get("local_files_only") == "local_files_only"