From 7eecd3685ef8eb5d5346dbce37a5a29c9feb4854 Mon Sep 17 00:00:00 2001 From: Junst Date: Wed, 17 Sep 2025 14:52:53 +0900 Subject: [PATCH] Fix attention_outputs error and alpha parameter issues 1. Fix 'attention_outputs' not defined error: - Change 'return attention_outputs' to 'return self.attention_outputs' - This fixes the NameError in ConceptAttention extraction 2. Fix alpha parameter validation issues: - Move alpha from 'required' to 'optional' in ConceptAttentionVisualizerNode - Remove alpha input from workflow JSON since it's now optional with default value - This resolves the 'Required input is missing: alpha' validation error These changes ensure the workflow runs without validation errors while maintaining the default alpha value of 0.5 for overlay blending. --- concept_attention.py | 2 +- example_workflow.json | 5 ++--- nodes.py | 2 ++ 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/concept_attention.py b/concept_attention.py index 2f81a5c..e36db6b 100644 --- a/concept_attention.py +++ b/concept_attention.py @@ -52,7 +52,7 @@ class ConceptAttention: logger.warning("Could not access named_modules, using fallback method") self._register_hooks_fallback(actual_model, hook_fn) - return attention_outputs + return self.attention_outputs def _register_hooks_fallback(self, model, hook_fn): """ diff --git a/example_workflow.json b/example_workflow.json index 5511468..1130fe8 100644 --- a/example_workflow.json +++ b/example_workflow.json @@ -101,14 +101,13 @@ "mode": 0, "inputs": [ {"name": "concept_maps", "type": "CONCEPT_MAPS", "link": 4}, - {"name": "image", "type": "IMAGE", "link": 1}, - {"name": "alpha", "type": "FLOAT", "link": null} + {"name": "image", "type": "IMAGE", "link": 1} ], "outputs": [ {"name": "visualized_image", "type": "IMAGE", "links": [11], "slot_index": 0} ], "properties": {"Node name for S&R": "ConceptAttentionVisualizerNode"}, - "widgets_values": [0.5] + "widgets_values": [] }, { "id": 7, diff --git a/nodes.py b/nodes.py index 39918ce..8f24a6f 100644 --- a/nodes.py +++ b/nodes.py @@ -686,6 +686,8 @@ class ConceptAttentionVisualizerNode: "required": { "concept_maps": ("CONCEPT_MAPS",), "image": ("IMAGE",), + }, + "optional": { "alpha": ("FLOAT", { "default": 0.5, "min": 0.0,