Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2026-08-17 14:35:52 +02:00
parent 1bc3420dfb
commit aa8cd9980e
3 changed files with 5 additions and 7 deletions
-2
View File
@@ -6,8 +6,6 @@ steps mirror the reference K2 inference code. This module imports only diffusers
so the repos can ship it for standalone use; SD.Next-specific wiring lives in the loader.
"""
import os
import torch
from einops import rearrange, repeat
+1 -1
View File
@@ -53,7 +53,7 @@ class Krea2InpaintPipeline(Krea2Img2ImgPipeline):
"""Krea 2 inpainting pipeline."""
@torch.no_grad()
def __call__(
def __call__( # pylint: disable=signature-differs
self,
prompt: Optional[Union[str, List[str]]] = None,
negative_prompt: Optional[Union[str, List[str]]] = None,
+4 -4
View File
@@ -121,8 +121,8 @@ def load_materialize_zero_init():
class _FakeTokenizedBatch(SimpleNamespace):
def to(self, device):
self.input_ids = self.input_ids.to(device)
self.attention_mask = self.attention_mask.to(device)
self.input_ids = self.input_ids.to(device) # pylint: disable=attribute-defined-outside-init
self.attention_mask = self.attention_mask.to(device) # pylint: disable=attribute-defined-outside-init
return self
@@ -176,7 +176,7 @@ def run_dense_prompt_compaction_test():
scheduler=fake_scheduler,
)
prompts = ["short", "longer prompt"]
hidden, mask = pipe.encode_prompt(prompts, device=torch.device("cpu"))
_hidden, mask = pipe.encode_prompt(prompts, device=torch.device("cpu"))
assert mask.shape[1] < pipe.MAX_LENGTH
assert mask.any(dim=0).all(), "Compacted prompt mask must contain no fully padded columns"
del os.environ["SD_KREA2_DENSE"]
@@ -269,7 +269,7 @@ def run_comfy_quant_real_file():
from pipelines.krea2 import KREA2_SPEC
transformer, siblings = nt.load(local_file=path, repo_id=repo_id, spec=KREA2_SPEC, diffusers_cfg={})
assert siblings == {}
assert not siblings
sdnq_layers = [m for m in transformer.modules() if m.__class__.__name__ == "SDNQLinear"]
storage_dtypes = {m.weight.dtype for m in sdnq_layers}