Files
diodiogod-TTS-Audio-Suite/utils/models/comfyui_model_wrapper.py
diodiogod d01e5cb807 Refactor comfyui_model_wrapper.py into modular architecture
- Split 970-line monolith into focused modules following 500-600 line policy
- Created utils/models/comfyui_model_wrapper/ directory structure:
  - base_wrapper.py (302 lines): Core ComfyUIModelWrapper class
  - model_manager.py (318 lines): ComfyUITTSModelManager class
  - cache_utils.py (28 lines): Cache invalidation utilities
  - engine_handlers/: Engine-specific memory management
    - higgs_audio_handler.py: CUDA graph management and unload blocking
    - vibevoice_handler.py: RAM cleanup and complete deletion logic
    - generic_handler.py: Standard CPU migration for other engines
- Fixed engine routing bug where stateless_tts wrappers weren't using HiggsAudioHandler
- Maintained full backward compatibility with existing imports
- All engine-specific behaviors preserved (VibeVoice deletion, Higgs CUDA graphs)
- Updated PROJECT_INDEX.md to reflect modular structure
2025-09-11 14:57:52 -03:00

27 lines
1.4 KiB
Python

"""
ComfyUI Model Wrapper for TTS Audio Suite - Backward Compatibility Module
This module maintains backward compatibility while delegating to the new modular structure.
The actual implementation has been refactored into separate modules for maintainability.
Legacy 970-line monolith replaced with modular architecture:
- utils/models/comfyui_model_wrapper/
├── __init__.py # Main exports
├── base_wrapper.py # Base ComfyUIModelWrapper class (~300 lines)
├── model_manager.py # ComfyUITTSModelManager class (~250 lines)
├── cache_utils.py # Cache invalidation utilities (~30 lines)
└── engine_handlers/ # Engine-specific handling (~150 lines each)
├── __init__.py # Handler factory
├── base_handler.py # Abstract base class
├── generic_handler.py # ChatterBox, F5-TTS, RVC, etc.
├── higgs_audio_handler.py # CUDA graph management
└── vibevoice_handler.py # RAM cleanup and deletion
Each module is now ~150-300 lines, following the 500-600 line policy.
"""
# Import everything from the modular structure for backward compatibility
from .comfyui_model_wrapper import *
# Ensure global instance is available at module level
from .comfyui_model_wrapper import tts_model_manager