diff --git a/nodes.py b/nodes.py index 78b3fdc..91e84b6 100644 --- a/nodes.py +++ b/nodes.py @@ -25,6 +25,11 @@ MODEL_LATENT_SPEC = { } DEFAULT_LATENT_SPEC = (4, 8) +# Unique models in presets.py order (most relevant first, per its own convention) — both +# nodes default to whichever model is listed first there, so adding a new architecture at +# the top of presets.py automatically becomes the new default without touching this file. +MODELS = list(dict.fromkeys(model for model, _, _, _ in PRESETS)) + ASPECT_RATIOS = [ ("1:1 Square", (1, 1)), ("3:2 Landscape", (3, 2)), @@ -63,10 +68,10 @@ class EmptyLatentAspectPreset: f"{w}x{h} - {lbl} - {model}": (w, h) for model, lbl, w, h in PRESETS } - # Unique models in first-appearance order; the "model" widget is purely a - # client-side filter (see web/aspect_ratio_filter.js) for the "preset" dropdown, - # which already encodes the model in its label — parsed there, not duplicated. - MODELS = list(dict.fromkeys(model for model, _, _, _ in PRESETS)) + # The "model" widget is purely a client-side filter (see web/aspect_ratio_filter.js) + # for the "preset" dropdown, which already encodes the model in its label — parsed + # there, not duplicated. + MODELS = MODELS @classmethod def INPUT_TYPES(cls): @@ -101,17 +106,17 @@ class EmptyLatentAspectByAxis: ASPECT_CHOICES = ASPECT_RATIOS REFERENCE_CHOICES = ["Width", "Height"] RATIO_MAP = dict(ASPECT_CHOICES) - MODELS = list(MODEL_LATENT_SPEC.keys()) + MODELS = MODELS @classmethod def INPUT_TYPES(cls): return { "required": { - "model": (cls.MODELS,), "primary_dim": ("INT", {"default": 512, "min": 8}), "reference": (cls.REFERENCE_CHOICES,), "aspect_ratio": ([lbl for lbl, _ in cls.ASPECT_CHOICES],), "batch_size": ("INT", {"default": 1, "min": 1}), + "model": (cls.MODELS,), } } @@ -120,7 +125,7 @@ class EmptyLatentAspectByAxis: FUNCTION = "generate" CATEGORY = "latent" - def generate(self, model: str, primary_dim: int, reference: str, aspect_ratio: str, batch_size: int): + def generate(self, primary_dim: int, reference: str, aspect_ratio: str, batch_size: int, model: str): if aspect_ratio not in self.RATIO_MAP: raise ValueError(f"Unknown aspect ratio: {aspect_ratio}") wr, hr = self.RATIO_MAP[aspect_ratio]