Files
EnragedAntelope-comfy-modelopt/__init__.py
T
Claude 95ff63c059 MAJOR UPDATE: Comprehensive model introspection and config fixes (v0.2.0)
This is a major update that should significantly improve compatibility and
reduce manual configuration for different model architectures.

Key Changes:

1. **Comprehensive Model Introspection** (NEW)
   - Added introspect_diffusion_model() utility function
   - Automatically detects:
     * Model architecture (SDXL, SD1.5, SD3, etc.)
     * Y dimension from 4 different methods:
       - adm_in_channels attribute
       - y_dim attribute
       - label_emb layer dimensions
       - Inferred from time_embed concatenation patterns
     * Context dimension for text conditioning
     * Latent format (channels and spatial dimensions)
     * Forward pass signature requirements
   - Prioritizes reliable detection methods
   - Falls back gracefully when attributes not found

2. **Fixed Quantization Configs**
   - Now uses ModelOpt default configs as base (INT8_DEFAULT_CFG, FP8_DEFAULT_CFG)
   - Customizes configs instead of building from scratch
   - This should fix "Inserted 0 quantizers" issue
   - Disables output quantization for better quality

3. **Improved Calibration**
   - Uses introspected model info instead of repeated detection
   - Cleaner error handling (detailed error only on first failure)
   - Uses correct y_dim, context_dim, and latent_shape from introspection
   - Should fix "mat1 and mat2 shapes cannot be multiplied" errors

4. **Simplified Startup Message**
   - Changed from verbose listing to simple: "NVIDIA ModelOpt for ComfyUI loaded successfully"
   - No more advertising during ComfyUI startup

5. **Better Debug Output**
   - Shows detected architecture details:
     * Architecture type
     * Y dimension and detection source
     * Context dimension
     * Latent format
     * Whether model has y parameter
   - Makes troubleshooting much easier

This update addresses the core issues:
- "Inserted 0 quantizers" - should be fixed by using default configs as base
- "Detected y_dim = None" - should be fixed by comprehensive introspection
- "mat1 and mat2 shapes cannot be multiplied" - should be fixed by using detected y_dim

Version: 0.2.0 (major update)
2025-11-10 03:17:51 +00:00

20 lines
556 B
Python

"""
ComfyUI NVIDIA ModelOpt Integration
Custom nodes for quantizing and loading models optimized with NVIDIA ModelOpt.
Installation:
1. Place this folder in ComfyUI/custom_nodes/
2. Install dependencies: pip install -r requirements.txt
3. Restart ComfyUI
For more information, see: https://github.com/EnragedAntelope/comfy-modelopt
"""
from .nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS"]
# Display startup message
print("NVIDIA ModelOpt for ComfyUI loaded successfully")