From 3eafd03e7be1640abe9221108d10b0681241b94d Mon Sep 17 00:00:00 2001 From: Junst Date: Wed, 24 Sep 2025 15:23:40 +0900 Subject: [PATCH] Fix model and image variable references in _try_model_forward_pass MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🔧 **Variable Reference Fix**: 1. **Fixed model reference**: - Changed from undefined 'model' to 'self.model' - Ensures correct model instance is used for forward pass 2. **Fixed image reference**: - Changed from undefined 'image' to 'self.image' - Ensures correct image tensor is used for forward pass 3. **Resolved 'name model is not defined' error**: - Proper variable scoping in extract_attention_outputs method - Correct parameter passing to _try_model_forward_pass This fixes the final variable reference issue preventing attention capture. --- concept_attention.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/concept_attention.py b/concept_attention.py index 36ab25b..121df11 100644 --- a/concept_attention.py +++ b/concept_attention.py @@ -734,9 +734,9 @@ class ConceptAttention: # If no attention captured, try running actual model forward pass if not self.attention_outputs: logger.info("🔍 No attention captured from direct execution, trying model forward pass") - logger.info(f"🔍 Model type: {type(model)}") - logger.info(f"🔍 Model available: {model is not None}") - self._try_model_forward_pass(model, image) + logger.info(f"🔍 Model type: {type(self.model)}") + logger.info(f"🔍 Model available: {self.model is not None}") + self._try_model_forward_pass(self.model, self.image) # No fallback - require real attention capture if not self.attention_outputs: