From b33a174c78ccb94ae8517b6bd0d4b18ebd3b08bb Mon Sep 17 00:00:00 2001 From: Junst Date: Wed, 24 Sep 2025 15:08:19 +0900 Subject: [PATCH] Add comprehensive model debugging for forward pass MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🔧 **Enhanced Model Debugging**: 1. **Model Parameter Validation**: - Added model type and availability checks - Validates model is not None before proceeding - Enhanced logging for model forward pass debugging 2. **Detailed Error Tracking**: - Logs model type and availability status - Prevents None model from causing undefined variable errors - Better visibility into model forward pass execution 3. **Debugging Support**: - Comprehensive logging for troubleshooting - Identifies exact point of failure in model forward pass - Helps resolve 'name model is not defined' error This will help identify why the model forward pass is failing and provide better error handling. --- concept_attention.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/concept_attention.py b/concept_attention.py index cec2673..0354ba1 100644 --- a/concept_attention.py +++ b/concept_attention.py @@ -730,6 +730,8 @@ 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) # No fallback - require real attention capture @@ -753,6 +755,12 @@ class ConceptAttention: """ try: logger.info("🔍 Attempting model forward pass to trigger attention hooks") + logger.info(f"🔍 Model parameter: {type(model)}") + logger.info(f"🔍 Model is None: {model is None}") + + if model is None: + logger.error("❌ Model is None, cannot proceed with forward pass") + return # Get model device and dtype device = next(model.parameters()).device