Commit Graph
66 Commits
Author SHA1 Message Date
diodiogod bb9a64f564 Fix tokenizer caching and console cleanup
- Consolidate character voice info into block generation messages
- Fix tokenizer path structure to match actual storage location (vibevoice/ instead of VibeVoice/tokenizer/)
- Use consistent path for tokenizer downloads so they're found on subsequent runs
- Comment out non-error device_map debug messages
- Remove duplicate SINGLE SEGMENT text printing
- Fix logged_characters to only log once per character (not per priority check)
2025-10-29 01:27:14 -03:00
diodiogod e373c49305 Fix RVC Clear VRAM button - register models with ComfyUI tracking
RVC models were being cached in minimal wrapper but not tracked by ComfyUI,
so Clear VRAM button couldn't see them.

Changes:
- Added is_dead() and model_memory() methods to ComfyUIModelWrapper for ComfyUI compatibility
- Created SimpleModelWrapper class for models without nested .model attribute
- RVC models now register with ComfyUI's current_loaded_models list on load
- Hubert models wrapped with SimpleModelWrapper to add .model attribute for logging
- Added device checking on cached model reuse - reloads from CPU to CUDA when needed
- Models re-register with ComfyUI after reload to stay tracked
- Extracted registration logic into helper methods to avoid duplication
- Updated clear_model_cache() to remove RVC models from ComfyUI tracking

RVC Clear VRAM now works correctly across multiple generation cycles.
2025-10-27 23:02:23 -03:00
diodiogod 19cad461ae Fix VibeVoice and RVC device management + VRAM spike fixes
VibeVoice:
- Added .to() method for device management
- Added device checking before generation that properly detects parameter device
- Fixed target_device to always use cuda if available (not self.device which gets updated)

RVC:
- Created RVCModelWrapper class to wrap model dicts with .to() method
- Added .to() method to RVCEngine for device management
- Added device checking to convert_voice() method
- Updated rvc_factory to properly load and wrap RVC models
- Added model caching to minimal_reference_wrapper to prevent reloading
- Added clear_model_cache() method for VRAM management
- Disabled CUDNN benchmark in vc_infer_pipeline.py to prevent VRAM spikes on Python 3.12+

All engines now support Clear VRAM button across multiple cycles.
2025-10-27 22:40:59 -03:00
diodiogod 98b167702f Fix Clear VRAM button for all TTS engines after CPU offload
Added comprehensive device management fixes to ensure "Clear VRAM" button
works correctly across multiple generation cycles for all TTS engines.

Changes:
- engines/chatterbox/tts.py: Added .to() method to ChatterboxTTS class
- engines/chatterbox/vc.py: Added .to() method to ChatterboxVC class
- nodes/base/base_node.py: Added device checking before generation that
  reloads models via wrapper system when device mismatch detected
- utils/models/comfyui_model_wrapper/engine_handlers.py: Created missing
  engine handlers file with BaseEngineHandler and HiggsAudioHandler

The fix ensures:
1. Models can be moved between CPU and CUDA via .to() method
2. Device mismatches are detected before generation
3. Models reload through wrapper.model_load() to stay in sync with ComfyUI
4. Wrappers re-register with ComfyUI after reload so Clear VRAM continues working

Tested with ChatterBox Classic and ChatterBox Official 23-Lang - both now
support multiple Clear VRAM cycles without errors.
2025-10-27 21:59:41 -03:00
diodiogod 43cd4f5bd9 Version 4.11.24
Fix ChatterBox Official 23-Lang device placement bug

Technical implementation:
- Add .to() method to ChatterBoxOfficial23LangTTS class for device migration
- Add .to() method to ChatterboxVC class for voice conversion device handling
- Improve wrapper's _move_all_components_to_device() with better recursion depth
- Fix unified_model_interface device resolution for 'auto' mode
- Add ComfyUI model management re-registration after wrapper.model_load()
- Fix model_finalizer setup when re-registering with ComfyUI
- Add device check in processor to call wrapper.model_load() instead of direct .to()

Fixes device mismatch errors:
- Fix 'Expected all tensors to be on the same device' error on second run
- Fix 'Inference tensors do not track version counter' after CPU detachment
- Fix 'Clear VRAM' button not working after model reload
2025-10-27 19:10:52 -03:00
diodiogod 955aff40a7 Fix ChatterBox v2 auto-download and pass model_version through entire chain
Fixed critical issues preventing v2 model auto-download:
1. Removed silent v1 fallback in from_local - now raises FileNotFoundError to trigger download
2. Updated unified_model_interface factory to pass model_version parameter
3. Factory now properly tries from_local first, then from_pretrained for auto-download
4. Added model_version parameter to generate_speech and load_tts_model signatures
5. Pass model_version from engine config through unified TTS node to processor
6. Updated README to clarify v1/v2 files coexist in same directory

Now when v2 is selected but files missing:
- from_local raises error instead of falling back to v1
- from_pretrained downloads missing v2 files automatically
- Model loads correctly with v2 tokenization enabled
2025-10-07 23:54:00 -03:00
diodiogod 1adaa1a22c Version 4.10.15
Fix VibeVoiceDownloader missing download_huggingface_model method

Technical details:
- Add missing download_huggingface_model method to VibeVoiceDownloader class
- Fix method delegation to unified_downloader in both real and dummy classes
- Resolve AttributeError when VibeVoice tokenizer download fails to cache
2025-09-29 08:28:18 -03:00
diodiogod 793722aa9a Version 4.10.12
Fix VibeVoice accelerate compatibility issues

Technical implementation:
- Add comprehensive transformers patches for accelerate detection
- Fix missing check_tied_parameters_on_same_device function
- Fix missing dispatch_model function for device mapping
- Smart patch application only when compatibility issues detected
- Add accelerate to critical dependencies monitoring
2025-09-26 14:54:28 -03:00
diodiogod c5c227b996 Version 4.10.11
Fix VibeVoice SageAttention compatibility issues

Technical improvements:
- Replace aggressive Qwen2Attention monkey-patching with safer SDPA wrapper approach
- Implement Enemyx-net's temporary F.scaled_dot_product_attention patching method
- Add proper EOS token handling for correct generation termination
- Fix model state corruption when switching between attention modes
- Add automatic fallback to original SDPA if SageAttention fails
- Eliminate need for ComfyUI restart when changing attention modes

Credits: SageAttention implementation approach adapted from @Enemyx-net's VibeVoice-ComfyUI
2025-09-26 12:10:08 -03:00
diodiogod df128496ba Fix IndexTTS-2 import conflicts with external installations
- Add detection for external IndexTTS installations that conflict with bundled version
- Display clear error message with uninstall instructions when conflicts are found
- Remove unnecessary adapter initialization log message
- Resolves import errors reported in issues #115, #116, and #101
2025-09-26 09:18:05 -03:00
diodiogod 827eb78428 Fix PyTorch installation commands in warnings
- Corrected invalid torchaudio+cu128 syntax to proper pip install torchaudio --index-url format
- Updated both torchaudio and torchvision warning commands to use cu129 index
- Fixes installation errors where users got 'Expected end or semicolon' pip errors
2025-09-26 00:13:32 -03:00
diodiogod 06c0f827a2 Version 4.10.0
Add universal multilingual text preprocessing support

Implementation details:
- Add 📝 Phoneme Text Normalizer node with 4 processing methods
- Implement IPA phonemization using espeak backend
- Add Unicode decomposition for special characters
- Add cross-platform phonemizer support (Windows/Linux/Mac)
- Add F5-Polish model auto-download from reference implementation
- Improve multilingual F5-TTS pronunciation issues (refs #22, #54, #58)
- Add Polish language support with high-quality model integration
2025-09-23 09:52:26 -03:00
diodiogod e7d191612c Version 4.9.21
Fix IndexTTS-2 auto-download system with complete model verification

Technical implementation:
- Move auto-download logic from unified interface to IndexTTS engine initialization
- Add comprehensive model verification using IndexTTSDownloader._verify_model()
- Handle mixed missing files scenarios (partial downloads, corrupted files)
- Improve error messages showing specific missing files and download status
- Fix auto-download trigger timing to occur before model loading attempt
2025-09-18 14:41:36 -03:00
diodiogod 307a482a7e Version 4.9.13
Fix IndexTTS-2 module import KeyError with bundled version

Technical fix:
- Simplify sys.modules override to prevent KeyError during import resolution
- Remove conflicting indextts modules before importing bundled version
- Keep bundled module available during IndexTTS-2 initialization
- Improve module path resolution for nested indextts imports
2025-09-17 20:13:32 -03:00
diodiogod ca156a103f Version 4.9.12
Fix IndexTTS-2 bundled import conflicts with system packages

Technical fix:
- Add sys.modules override to force bundled indextts during import
- Prevent conflicts with system-installed indextts packages
- Ensure bundled IndexTTS-2 code resolves internal imports correctly
- Restore original module state after import to avoid side effects
2025-09-17 19:55:17 -03:00
diodiogod d619d38747 Version 4.9.4
Fix VibeVoice garbage collection and auto device detection issues

Technical fixes:
- Add defensive gc import handling to prevent UnboundLocalError crashes
- Implement proper auto device detection for VibeVoice after model unloading
- Fix ComfyUI model wrapper gc.collect() scoping issues
- Improve device persistence for subsequent generations
- References issue #81 VibeVoice garbage collection errors
2025-09-16 19:21:47 -03:00
diodiogod 991be1ca85 Fix IndexTTS-2 device mismatch error after model unload/reload
- Add IndexTTS-2 specific recovery logic in model manager
- Handle device synchronization when model is corrupted after CPU offloading
- Clear cached model config and force device reload for all components
- Add recovery for both normal reuse and force_reload scenarios
- Matches existing patterns used for Higgs Audio and VibeVoice

Fixes: RuntimeError: Expected all tensors to be on the same device,
but got weight is on cpu, different from other tensors on cuda:0
2025-09-16 15:55:35 -03:00
diodiogod e8b151550e Add IndexTTS-2 SRT subtitle processing support
Implement complete SRT subtitle processing for IndexTTS-2 engine with:
- Character switching with emotion references using existing parser
- Full SRT timing support (stretch_to_fit, pad_with_silence, smart_natural, concatenate)
- Pause tag support with emotion control
- Language mapping integration for multilingual support
- Unified interface integration following VibeVoice pattern

Key components:
- IndexTTSSRTProcessor: Clean SRT processor using existing IndexTTSProcessor
- Language mapper support: Added index_tts engine type with multilingual handling
- Unified SRT node integration: Added IndexTTS-2 to unified TTS SRT interface
2025-09-15 09:22:28 -03:00
diodiogod a3a7c4a50c Add PyTorch consistency warning to unified model interface
- Detects mixed CUDA/CPU PyTorch installations on first model load
- Warns about GPU PyTorch + CPU TorchAudio performance issues
- Shows exact fix commands with proper CUDA index URLs
- Prevents performance degradation debugging sessions
- Only shows warning once per session
2025-09-12 17:38:40 -03:00
diodiogod b965a38326 Add IndexTTS-2 engine - initial implementation and basic testing
- Initial IndexTTS-2 TTS engine implementation
- Basic unified interface integration
- Auto-download system for IndexTTS-2 models
- Character voice switching support via QwenEmotion
- Token-based chunking system
- ComfyUI model management integration
- Fixed debug output and basic inference working
- Multi-language text preprocessing foundation
- Basic error handling framework

Note: Initial implementation - requires further testing and refinement
2025-09-12 09:33:55 -03:00
diodiogod e129c5314b IndexTTS-2 implementation with modular character parser
MAJOR: IndexTTS-2 TTS engine integration
- Core IndexTTS engine with unified model interface integration
- Auto-downloader for HuggingFace models + GitHub source code
- Engine adapter with emotion support [Alice:angry_bob] syntax
- Cache integration for IndexTTS-2 parameters
- Factory registration for proper model management

MAJOR: Character parser modularization (930 → 300 lines each)
- Split into base_parser.py, language_resolver.py, segment_processor.py, validation.py
- Added emotion support with backward compatibility
- New split_by_character_with_emotions() method for advanced engines
- Flexible tag parsing: [de:Alice:angry_bob] support
- Language disambiguation to avoid Alice vs language code conflicts
- Full backward compatibility maintained

FEATURES:
- IndexTTS-2 emotion disentanglement (speaker vs emotion separation)
- Duration control and precise voice cloning
- Multi-modal emotion control (audio refs, text, vectors)
- Character switching with emotion references
- All official IndexTTS-2 parameters exposed

DOCS: Implementation plan and architectural TODO items added
2025-09-11 20:26:51 -03:00
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
diodiogod d1974c511f Version 4.8.34
Implement ComfyUI extra_model_paths.yaml support

Technical implementation:
- Add TtsExtraPathsManager for shared model directory integration
- Update unified downloader to respect configured model paths
- Enhance voice discovery with multi-path fallback support
- Integrate model manager with extra_model_paths.yaml system
- Support shared storage across multiple ComfyUI installations
- Maintain backward compatibility with existing setups
- Reference: GitHub issue #63
2025-09-10 13:06:22 -03:00
diodiogod 9ad7c78893 Add extra_model_paths.yaml support and enhance voice discovery
Technical implementation:
- Add TtsExtraPathsManager for ComfyUI extra_model_paths.yaml integration
- Support shared model directories across multiple ComfyUI installations
- Implement intelligent model discovery across configured paths
- Add voice discovery fallback: models/voices → models/TTS/voices → examples
- Update character alias map loading with proper priority system
- Enhance voice directory scanning to include TTS organization structure
- Add changelog guidelines requiring engine names in titles
- Reference: GitHub issue #63
2025-09-10 12:12:32 -03:00
diodiogod e6b9a5ab80 Version 4.8.27
Centralize numba compatibility system with smart testing

Technical implementation:
- Replace 15+ duplicate JIT workaround blocks with unified system
- Add utils/compatibility/numba_compat.py with startup testing
- Implement fallback for environments without compatibility module
- Test librosa.stft() at startup and apply workarounds only when needed
- Eliminate contradictory startup messages between init and nodes
- Maintain backward compatibility with legacy Python 3.13 fixes
2025-09-09 00:40:06 -03:00
diodiogod 6096214799 Version 4.8.25
Fix VibeVoice VRAM clearing and model reloading

Technical improvements:
- Fix model reloading when switching attention modes
- Add proper VRAM clearing with CPU migration approach
- Implement VibeVoice-specific nuclear CUDA cleanup
- Add cache key generation for attention_mode parameters
- Note: System RAM accumulation still needs resolution
2025-09-07 11:38:55 -03:00
diodiogod 450e7c80d3 Version 4.8.24
Fix VibeVoice model reloading and transformers compatibility

Technical changes:
- Fix unified model interface cache key missing additional_params
- Add transformers>=4.51.3 requirement for VibeVoice compatibility
- Remove excessive debug prints from VibeVoice engine
- Fix RVC numba JIT disable logic for correct Python version detection
- Fix attention_mode and quantize_llm_4bit not triggering model reloads
2025-09-07 10:13:23 -03:00
diodiogod e7136cbefe Version 4.8.23
Add ChatterBox Official 23-Lang to ComfyUI VRAM management

Technical improvements:
- Register ChatterBox 23-Lang in unified model interface
- Update processors to use unified interface for model loading
- Fix Python 3.13 compatibility by replacing librosa.effects.trim with safe_trim fallback
- Add proper factory method using ChatterboxOfficial23LangTTS.from_local()
2025-09-07 00:17:35 -03:00
diodiogod e9c0199a81 Version 4.8.22
Fix VibeVoice model reloading and add VRAM management

Technical improvements:
- Add class-level model caching to prevent reloading on each run
- Register VibeVoice in unified model interface
- Update adapter to use unified interface for ComfyUI integration
- Fix OOM errors on subsequent runs
2025-09-07 00:01:23 -03:00
diodiogod 3e5f9a3721 Fix RVC Python 3.13 compatibility - comprehensive numba/librosa solution
Major compatibility overhaul for RVC engine in Python 3.13 environments:

🔧 Core Compatibility Fixes:
• Disabled numba JIT compilation for Python 3.13+ via environment variables
• Added comprehensive librosa compatibility patches for missing functions:
  - pad_center, tiny (as function), fill_off_diagonal, is_positive_int, expand_to
• Replaced librosa.resample with torchaudio.resample to eliminate numba dependency
• Fixed all relative imports in RVC implementation (. notation)

⚡ Performance Improvements:
• Manual RMS calculation replacing librosa.feature.rms (avoids numba)
• Higher quality audio resampling using torchaudio
• Maintains backward compatibility with Python 3.12

🐛 Bug Fixes:
• Fixed 'function' object has no attribute 'get_call_template' errors
• Resolved 'float' object is not callable in librosa.sequence.viterbi
• Fixed ImportError for missing librosa utility functions
• Enhanced error handling and debugging throughout RVC pipeline

✨ Features:
• Comprehensive monkey-patching system for librosa compatibility
• Automatic fallbacks for failed operations
• Detailed logging for troubleshooting

Successfully tested with full RVC voice conversion workflow in Python 3.13.6.
2025-09-06 17:22:33 -03:00
diodiogod 79f43d470f Version 4.8.17
Fix ChatterboxVC import issue causing 'NoneType' object is not callable

Technical fixes:
- Add null checks in model manager before calling ChatterboxVC methods
- Make perth import optional with graceful fallback for Python 3.13 compatibility
- Update watermarking code to handle missing perth dependency
- Improve error messages for better debugging
2025-09-06 15:22:13 -03:00
diodiogod c23930912a Version 4.8.7
Fix ChatterBox transformer compatibility issue

Technical changes:
- Set attention implementation to eager mode
- Fix output_attentions conflict with sdpa in transformers 4.36+
- Maintain alignment analyzer functionality
2025-09-06 08:38:08 -03:00
diodiogod e86be32b1a Fix ChatterBox VC language support and improve error handling
- Add VC component detection system to check s3gen availability for all languages
- Implement universal ChatterBox model loading with component mixing fallback
- Fix VC download system to handle subdirectories (German havok2 model)
- Add graceful handling of optional files (conds.pt) vs required files (s3gen)
- Propagate 401 authentication errors properly through download system
- Add intelligent fallback: German variants → German base → English
- Return silent audio for unsupported VC languages instead of crashing
- Remove misleading claims about unverified VC language support
- Fix file format detection (.pt vs .safetensors) in VC downloads

Resolves VC crashes with Japanese/incomplete models and improves German model support
2025-09-04 16:06:18 -03:00
diodiogod a36b09d8ca Add Italian ChatterBox TTS support with unified model architecture
- Add Italian to CHATTERBOX_MODELS registry with unified_model special flag
- Implement _load_unified_model() method for Italian checkpoint format
- Italian model uses single chatterbox_italian_final.pt with all components
- Load base architecture then replace with fine-tuned Italian weights
- Support bilingual Italian/English with [it] language prefix
- Extended vocabulary: 1500 tokens (704 frozen English + 796 trainable Italian)
- Update language mapper for Italian language code 'it' -> 'Italian'
- Based on deployment script analysis from niobures repository

Usage: Italian text requires '[it]' prefix, English text uses no prefix
2025-09-04 01:13:04 -03:00
diodiogod 5089b86e1f Fix ChatterBox model completeness and tokenizer naming issues
- Add special tokenizer filename handling for Japanese (tokenizer_jp.json) and Korean (tokenizer_en_ko.json)
- Mark French model as incomplete (only has t3_cfg.safetensors)
- Update model requirements validation for incomplete models
- Fix dynamic tokenizer discovery in TTS loading
- Ensure all niobures language models have correct file expectations
2025-09-04 00:40:58 -03:00
diodiogod 2f29a7d746 Update ChatterBox language mapper integration with alias system
- Remove duplicate alias definitions (character_parser already handles this)
- Map canonical language codes to ChatterBox models efficiently
- Support natural language tags: [USA:], [Deutschland:], [France:], [Russia:]
- Enable ChatterBox-specific model variants: [de-best:], [de-expressive:]
- Unified alias system now works across F5-TTS and ChatterBox engines

Users can now use natural language switching:
- [USA:John] Hello → English model
- [Deutschland:Hans] Hallo → German model
- [France:Marie] Bonjour → French model
- [Russia:Ivan] Привет → Russian model
- [de-best:Klaus] Das beste Modell → German (havok2) model
2025-09-04 00:30:45 -03:00
diodiogod 1605b06b59 Version 4.6.16
Refactor VibeVoice to use ComfyUIModelWrapper

Technical details:
- Replace custom model caching with unified ComfyUI wrapper system
- Remove custom unload hooks in favor of automatic ComfyUI integration
- Implement VibeVoiceModelContainer for proper model/processor handling
- Eliminate manual CPU movement code and global flag management
- Achieve architectural consistency with other TTS engines
2025-08-30 14:13:51 -03:00
diodiogod c2b9b222fd Version 4.6.15
Fix VibeVoice unload button and VRAM management

Technical details:
- Hook VibeVoice models into ComfyUI's 'Unload Models' button
- Move models to CPU during unload to actually free VRAM
- Invalidate engine caches to prevent tensor corruption errors
- Fix 'Inference tensors do not track version counter' after unload
- Ensure fresh model recreation after unload for proper functionality
2025-08-30 12:41:50 -03:00
diodiogod 6e32362dc4 Integrate VibeVoice with ModelManager caching system
Technical details:
- Add VibeVoice model loading and caching to ModelManager class
- Modify VibeVoice adapter to use ModelManager instead of creating own engine instances
- Add load_vibevoice_model() and unload_vibevoice_models() methods to ModelManager
- Import VibeVoice components into ModelManager with availability checking
- Update adapter to cache model and processor instances via ModelManager
- Follow ChatterBox pattern for persistent model caching across node executions
2025-08-30 12:26:06 -03:00
diodiogod 0d754c9ce9 Fix VC model loading fallback for corrupted local files
Technical details:
- Always include huggingface fallback even when local language path exists
- Resolve issue where partial/corrupted local VC models prevent fallback
- Add better cache error logging and source summary diagnostics
- Maintain cache checking functionality for users with HF cache
2025-08-30 10:03:05 -03:00
diodiogod 9c0dfc3f94 Add VibeVoice SRT support with unified architecture
Implemented complete VibeVoice SRT processor with dual mode support:

Features:
• Native Multi-Speaker Mode: One segment per subtitle using VibeVoice's Speaker 1:, Speaker 2: format
• Custom Character Switching Mode: Multiple segments per subtitle (one per character)
• Full SRT timing support: stretch_to_fit, pad_with_silence, smart_natural, concatenate
• Modular architecture using existing utils (no code duplication)
• Character switching with voice discovery integration
• Pause tag support in both modes
• Smart language grouping and model switching

Technical Implementation:
• Added VibeVoiceSRTProcessor with complete SRT workflow
• Updated unified SRT node to support vibevoice engine
• Added VibeVoice to language_mapper utility
• Proper ComfyUI audio format handling
• Fixed timing adjustment format for detailed reports

Integration:
• Uses existing timing utils, audio assembly, and reporting modules
• Compatible with Character Voices node
• Maintains same interface as ChatterBox/F5-TTS SRT nodes
2025-08-29 22:35:01 -03:00
diodiogod 04940f013e Implement CUDA Graph toggle for Higgs Audio with DynamicCache support
Adds user toggle to choose between high performance (CUDA Graphs) and memory safety:

**High Performance Mode (CUDA Graphs ON):**
- Uses StaticCache for CUDA Graph optimization
- ~55 tokens/sec generation speed
- Cannot safely unload memory (crashes on "Unload Models")
- Users must restart ComfyUI to free VRAM

**Memory Safe Mode (CUDA Graphs OFF):**
- Uses DynamicCache for safe memory management
- ~12 tokens/sec generation speed (78% slower)
- Safe memory unloading with "Unload Models" button
- Full VRAM cleanup and reload cycles work

**Key Implementation Changes:**
- Add enable_cuda_graphs parameter to HiggsAudioServeEngine constructor
- Conditional cache creation: StaticCache vs DynamicCache based on toggle
- Fix DynamicCache compatibility issues:
  - Manual cache clearing (key_cache.clear(), value_cache.clear())
  - Compatible get_seq_length() handling for both cache types
  - Proper cache copying between DynamicCache instances
- Update tooltip with accurate performance numbers (12 tok/s vs 55+ tok/s)
- Complete parameter passing chain from UI to engine constructor

**Files Modified:**
- serve_engine.py: Add constructor parameter, conditional cache creation, DynamicCache reset
- modeling_higgs_audio.py: Fix get_cache_seq_length() compatibility, DynamicCache copying
- unified_model_interface.py: Pass enable_cuda_graphs to constructor
- higgs_audio_engine_node.py: Add toggle UI with accurate performance tooltip
- stateless_wrapper.py: Conditional cleanup logic based on cache type
- higgs_audio.py: Parameter passing integration
- higgs_audio_adapter.py: Extract and pass toggle parameter

Resolves fundamental CUDA Graph vs ComfyUI memory management incompatibility by giving users choice.
2025-08-28 15:01:51 -03:00
diodiogod 5700ec3f0c Implement Higgs Audio stateless wrapper for ComfyUI model management integration
✅ Major Achievement: Higgs Audio can now be safely unloaded from VRAM without crashes!

Key Implementation:
- Created StatelessHiggsAudioWrapper that isolates tensor state to prevent CUDA Graph corruption
- Unified model interface integration with CPU-first loading to prevent VRAM overflow
- Enhanced ComfyUI model wrapper to handle stateless TTS models generically
- Fixed device consistency for all model components (main_model, audio_tokenizer, semantic_model, tokenizer_encoder, tokenizer_quantizer)

Results:
- Successfully freed 11007MB VRAM without crashes
- Model unloading/reloading cycle works correctly
- CUDA Graph corruption issue resolved through tensor isolation

Note: Device mismatch issue during voice cloning still needs resolution, but core memory management functionality is working.
2025-08-28 00:52:49 -03:00
diodiogod 23a9d37c1b Version 4.5.16: Clean up verbose console logging across all TTS engines 2025-08-26 15:58:25 -03:00
diodiogod bad1dd4a12 Version 4.5.13: Clean up excessive startup logging messages 2025-08-26 09:47:39 -03:00
diodiogod 0505e735c0 Remove repetitive Higgs Audio memory management warnings
- Add class-level flags to show memory management warnings only once per session
- Prevents spam of 'Memory Management Limitation' messages for every segment
- Still shows 'Skipping unload' for each unload attempt, but detailed warnings only once
- Significantly reduces console spam during multi-segment SRT generation
2025-08-25 22:58:46 -03:00
diodiogod c0ed537a00 Remove unnecessary debug messages from TTS output
- Remove repeated 'TTS Model loaded_size query' messages
- Only show CUDA graph checking for Higgs Audio models (not ChatterBox)
- Comment out cache key generation debug (not needed for end users)
- Reduces console spam while preserving relevant debugging for Higgs models
2025-08-25 22:53:23 -03:00
diodiogod 9a37b2826b Fix F5-TTS language model switching for character alias system
Remove restrictive logic that blocked language switching when no explicit [lang:character] tags present. Character alias system (Alice→German, Bob→French) now correctly loads language-specific models:

- F5-DE for German segments
- F5-FR for French segments
- F5TTS_v1_Base for English segments

Language switching works with both explicit tags and character alias mappings.
2025-08-25 21:48:00 -03:00
diodiogod 5ff56384c5 Fix ChatterBox device mismatch after memory management cycles
- Add missing s3gen.to(device) in ChatterBox TTS class to move all components
- Fix Smart Loader device resolution for "auto" to "cuda" conversion
- Implement comprehensive device management for cached model reuse
- Disable Higgs Audio memory management due to CUDA graph limitations
- Add recursive component device moving in ComfyUI wrapper

Memory management now works correctly for ChatterBox and F5-TTS engines while preserving Higgs Audio performance.
2025-08-25 21:11:26 -03:00
diodiogod 5c741f7403 Implement comprehensive CUDA graph memory corruption fix for Higgs Audio models
- Add global cache invalidation system to prevent reuse of corrupted model state
- Implement deferred CUDA graph initialization in Higgs Audio engine (prevents corruption during model loading)
- Add shadow storage system for Higgs Audio models to avoid PyTorch memory conflicts
- Implement timestamped engine caching across all unified nodes (TTS Text, TTS SRT, Voice Changer)
- Add comprehensive ComfyUI model management integration with proper device handling
- Fix model unloading/reloading cycle to prevent "Assertion input[0] != 0 failed" CUDA crashes
- Add model resurrection system that reuses existing models instead of creating new instances
- Implement intelligent cache validation with global invalidation flags
- Add extensive debugging and state tracking for model lifecycle management
- Fix device compatibility between string and torch.device objects in ComfyUI integration

This resolves the critical memory corruption issue that occurred when using ComfyUI's
"Unload models" or "Clear VRAM" buttons with Higgs Audio models containing CUDA graphs.
2025-08-25 17:56:11 -03:00