Fix model and image variable references in _try_model_forward_pass

🔧 **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.
This commit is contained in:
Junst
2025-09-24 15:23:40 +09:00
parent 811cf27147
commit 3eafd03e7b
+3 -3
View File
@@ -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: