From f7aa1bbe457230fb7e2aaf9e4fdc32152615f674 Mon Sep 17 00:00:00 2001 From: xmarre Date: Sat, 2 May 2026 01:53:49 +0200 Subject: [PATCH] Address PR review feedback for SDXL node imports and options safety --- __init__.py | 15 +++++++++++++-- nodes_sdxl.py | 5 +++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/__init__.py b/__init__.py index c081c16..eb1b8e8 100644 --- a/__init__.py +++ b/__init__.py @@ -18,8 +18,19 @@ except ImportError as exc: # SDXL/UNet support is intentionally kept in a separate module because the # faithful TIDE text-anchor path is MM-DiT-specific. This registers the SDXL # adaptation without changing existing FLUX nodes. -from .nodes_sdxl import NODE_CLASS_MAPPINGS as _SDXL_NODE_CLASS_MAPPINGS -from .nodes_sdxl import NODE_DISPLAY_NAME_MAPPINGS as _SDXL_NODE_DISPLAY_NAME_MAPPINGS +try: + from .nodes_sdxl import NODE_CLASS_MAPPINGS as _SDXL_NODE_CLASS_MAPPINGS + from .nodes_sdxl import NODE_DISPLAY_NAME_MAPPINGS as _SDXL_NODE_DISPLAY_NAME_MAPPINGS +except ModuleNotFoundError as exc: + if exc.name not in {f"{__package__}.nodes_sdxl", "nodes_sdxl"}: + raise + from nodes_sdxl import NODE_CLASS_MAPPINGS as _SDXL_NODE_CLASS_MAPPINGS + from nodes_sdxl import NODE_DISPLAY_NAME_MAPPINGS as _SDXL_NODE_DISPLAY_NAME_MAPPINGS +except ImportError as exc: + if "attempted relative import with no known parent package" not in str(exc): + raise + from nodes_sdxl import NODE_CLASS_MAPPINGS as _SDXL_NODE_CLASS_MAPPINGS + from nodes_sdxl import NODE_DISPLAY_NAME_MAPPINGS as _SDXL_NODE_DISPLAY_NAME_MAPPINGS NODE_CLASS_MAPPINGS.update(_SDXL_NODE_CLASS_MAPPINGS) try: diff --git a/nodes_sdxl.py b/nodes_sdxl.py index 92db716..9d759bd 100644 --- a/nodes_sdxl.py +++ b/nodes_sdxl.py @@ -166,7 +166,7 @@ class TIDESDXLHighRes: "model": ("MODEL",), "width": ("INT", {"default": 1536, "min": 64, "max": 16384, "step": 8}), "height": ("INT", {"default": 1536, "min": 64, "max": 16384, "step": 8}), - "temperature_strength": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 2.0, "step": 0.05}), + "temperature_strength": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.05}), "base_width": ("INT", {"default": 1024, "min": 64, "max": 16384, "step": 8}), "base_height": ("INT", {"default": 1024, "min": 64, "max": 16384, "step": 8}), "alpha": ("FLOAT", {"default": 0.6, "min": 0.01, "max": 4.0, "step": 0.05}), @@ -203,7 +203,7 @@ class TIDESDXLHighRes: apply_to=str(apply_to), ) - transformer_options = patched.model_options.setdefault("transformer_options", {}) + transformer_options = patched.model_options.get("transformer_options", {}).copy() previous_override = transformer_options.get("optimized_attention_override", None) transformer_options["optimized_attention_override"] = build_sdxl_attention_override(config, previous_override) transformer_options["tide_sdxl"] = { @@ -216,6 +216,7 @@ class TIDESDXLHighRes: "tau_max": config.tau_max, "apply_to": config.apply_to, } + patched.model_options["transformer_options"] = transformer_options return (patched,)