Files
diodiogod-TTS-Audio-Suite/utils/models
diodiogod a8f49bea1e Add sage_attn support to Qwen3-TTS with proper cache invalidation
Implements sage attention (sageattention) for Qwen3-TTS with:
- Auto-detection priority: sage_attn > flash_attention_2 > sdpa > eager
- Post-load attention module patching for sage_attn
- Graceful fallback to sdpa if sage_attn fails
- Proper cache invalidation on attention mode changes

Cache improvements:
- Added attn_implementation to engine instance cache key
- Added attn_implementation to audio cache key generator
- Added x_vector_only_mode to audio cache key (was missing)
- Prevents cache hits when switching attention modes

VRAM management improvements:
- Proactively unload old same-engine model variants before loading new ones
- Prevents VRAM accumulation when changing parameters (attn, dtype, etc.)
- Smart offloading when VRAM pressure detected by ComfyUI

Files changed:
- nodes/engines/qwen3_tts_engine_node.py: Added sage_attn to dropdown
- utils/models/unified_model_interface.py: Sage attention detection & patching
- nodes/unified/tts_text_node.py: Include attn_implementation in cache key
- engines/adapters/qwen3_tts_adapter.py: Pass attn_implementation to cache
- utils/audio/cache.py: Include attn_implementation & x_vector_only in cache
- utils/models/.../model_manager.py: Proactive same-engine variant unloading
2026-01-28 01:13:40 -03:00
..
2025-09-29 08:28:18 -03:00