Commit Graph
19 Commits
Author SHA1 Message Date
diodiogod 54a714bfcf Version 4.24.3
Fix ChatterBox SRT multiline segment routing and 23-Lang language tag switching

Technical details:
- Route Classic ChatterBox and ChatterBox Official 23-Lang multiline SRT subtitles through segmented generation
- Fix ChatterBox Official 23-Lang multilingual SRT processing to keep per-segment language tags like [pt:]
- Add generic pt alias so language-only Portuguese tags parse correctly
2026-03-18 10:50:50 -03:00
diodiogodandNicolas Martel 6195d5407a Merge true lazy node PR 262 but keep instant check_dependencies
Co-authored-by: Nicolas Martel <teoxysoft@gmail.com>
2026-02-20 17:45:50 -03:00
diodiogod 88feb3a99a Add Qwen3-TTS engine with Phase 1 implementation
Implements complete Qwen3-TTS integration following NEW_ENGINE_IMPLEMENTATION_GUIDE
with unified architecture, character switching, language support, and Voice Designer.

## Core Engine Implementation

**Engine Wrapper** (`engines/qwen3_tts/qwen3_tts.py`):
- Wraps official Qwen3-TTS implementation with .to() method for VRAM management
- Device checking before generation with automatic model reload
- Support for 3 model types: CustomVoice (presets), VoiceDesign (text-to-voice), Base (voice cloning)
- Progress bar integration via transformers streamer interface
- 24kHz mono audio output in ComfyUI-compatible format

**Bundled Implementation** (`engines/qwen3_tts/impl/`):
- Official Qwen3-TTS library bundled for stability
- Patched modeling_qwen3_tts.py (line 2069) for progress callback support
- Sox dependency stubbed out (25Hz models only, we use 12Hz)
- Supports 6 models: 0.6B/1.7B × CustomVoice/VoiceDesign/Base

**Adapter** (`engines/adapters/qwen3_tts_adapter.py`):
- Intelligent model selection based on context (voice_preset/node_type)
- Automatic switching: preset→CustomVoice, None→Base, Designer→VoiceDesign
- Full caching integration with audio_cache.generate_cache_key()
- Voice reference processing for Base model (audio + transcript)
- Character-to-speaker mapping for CustomVoice presets (deterministic MD5 hashing)

## Node Implementation

**Engine Configuration Node** (`nodes/engines/qwen3_tts_engine_node.py`):
- Unified interface with voice_preset dropdown (9 preset speakers + None for zero-shot)
- Model size selection: 0.6B (low VRAM) / 1.7B (high quality)
- Language dropdown: Auto + 10 languages (Chinese, English, Japanese, Korean, German, French, Russian, Portuguese, Spanish, Italian)
- Conditional instruction field (locked when unsupported: Base model or 0.6B CustomVoice)
- Generation parameters: top_k, top_p, temperature, repetition_penalty, max_new_tokens
- Advanced: dtype, attn_implementation, x_vector_only_mode

**Voice Designer Node** (`nodes/qwen3_tts/qwen3_tts_voice_designer_node.py`):
- UNIQUE FEATURE: Create voices from natural language descriptions
- Smart disk check: loads existing characters without model loading/generation
- Runtime caching for same-session regeneration optimization
- Saves to models/voices/ with standard format (.wav + .reference.txt + .txt metadata)
- Outputs unified NARRATOR_VOICE format matching Character Voices node
- Duplicate detection prevents regenerating identical voices

**TTS Processor** (`nodes/qwen3_tts/qwen3_tts_processor.py`):
- Full character switching support via character parser
- CustomVoice: deterministic character→preset mapping (preserves narrator's chosen preset)
- Base: uses models/voices/ audio references (standard voice cloning)
- VoiceDesign: uses saved voice descriptions from Designer node
- Pause tag processing with silence generation
- Language switching support via [language:Character] tags
- Segment parameter support ([seed:X], [temperature:0.8])
- Interrupt handling for cancellation
- Chunk combining with ChunkCombiner + ChunkTimingHelper

## JavaScript Widget

**Widget Locking** (`web/qwen3_tts_widgets.js`):
- Conditional UI: locks instruction field when unsupported
- Locked when: voice_preset="None" OR (model_size="0.6B" + preset selected)
- Console warnings explain limitations
- Preserves field value when locked (doesn't clear)

## System Integration

**Language Support** (`utils/models/language_mapper.py`):
- Added QWEN3_TTS_LANGUAGE_MAP: maps ISO codes to full names (e.g., "po"→"Portuguese")
- Added map_language_code_to_qwen3_tts() helper function
- Added "po" to global LANGUAGE_ALIASES (maps to pt-pt)
- Qwen3-TTS expects FULL language names, not ISO codes

**Unified Model Interface** (`utils/models/unified_model_interface.py`):
- Registered qwen3_tts factory in initialize_all_factories()
- Consolidated loading messages (single-line model loading output)
- Context-based model selection (VoiceDesign/CustomVoice/Base)

**Segment Parameters** (`utils/text/segment_parameters.py`):
- Added "qwen3_tts" to PARAMETER_ENGINES for inline tag support

**Voice Discovery** (`utils/voice/discovery.py`):
- Enhanced get_character_mapping() to detect VoiceDesign saved voices
- Checks for voice metadata format (description vs audio reference)
- Returns voice type for processor to handle correctly

**TTS Text Node** (`nodes/unified/tts_text_node.py`):
- Added qwen3_tts processor routing
- CustomVoice console messages (shows preset speaker instead of narrator warning)
- Recognizes unified NARRATOR_VOICE format from Voice Designer
- Language code mapping display (shows "po" → "Portuguese" conversion)

**Node Registration** (`nodes.py`):
- Registered Qwen3TTSEngineNode and Qwen3TTSVoiceDesignerNode
- Added error handling with fallback messages

## Features Implemented (Phase 1 Complete)

✅ Basic engine integration with unified architecture
✅ Character switching (CustomVoice presets + Base model cloning)
✅ Language switching (10 languages + Auto detection)
✅ Pause tags ([pause:1.5])
✅ Segment parameters ([seed:42], [temperature:0.8])
✅ Audio caching (prevents duplicate generation)
✅ VRAM management (.to() method + device checking)
✅ Interrupt handling (user cancellation)
✅ Progress bars (console + ComfyUI)
✅ Voice Designer (text-to-voice creation)
✅ Smart disk caching (skips regeneration for saved voices)
✅ Unified NARRATOR_VOICE output format

## Technical Details

- **Sample Rate**: 24kHz mono
- **Models**: 6 variants (0.6B/1.7B × CustomVoice/VoiceDesign/Base)
- **Tokenizer**: Qwen3-TTS-Tokenizer-12Hz (12.5 fps, 16 quantizers)
- **Languages**: 10 (Chinese, English, Japanese, Korean, German, French, Russian, Portuguese, Spanish, Italian)
- **CustomVoice Presets**: 9 (Vivian, Serena, Uncle_Fu, Dylan, Eric, Ryan, Aiden, Ono_Anna, Sohee)
- **Audio Format**: torch.Tensor [1, 1, samples] at 24kHz
- **Cache Integration**: Uses audio_cache with stable key generation
- **Character Mapping**: MD5-based deterministic assignment (cache-friendly)

## Testing Completed

- Engine node loads and configures correctly
- Preset voice generation (CustomVoice with 9 speakers)
- Zero-shot cloning (Base model with voice references)
- Voice Designer text-to-voice generation
- Character switching with automatic preset mapping
- Pause tags create correct silence durations
- Language selection and switching
- Caching prevents duplicate generation
- VRAM management (Clear VRAM + reload)
- Generation info reports with timing
- Interrupt cancellation
- Widget locking behavior
- Disk check optimization (skips model loading for existing voices)

## Phase 2+ (Future)

- SRT processor integration (Phase 4)
- Streaming generation (requires special deployment)
- Fine-tuning nodes (advanced feature)
2026-01-28 00:02:02 -03:00
diodiogod a8e2de16e7 Version 4.17.0
Add Vietnamese (Viterbox) community finetune support

Implementation details:
- Add Vietnamese (Viterbox) as model_version option for ChatterBox Official 23-Lang
- Support dolly-vn/viterbox repository with expanded Vietnamese tokenization (2549 tokens)
- Add flexible T3 model filename detection for community finetunes
- Add version normalization for file lookups and tokenizer selection
- Add Vietnamese language code mapping in language_mapper.py
- Fix vocab size detection by loading tokenizer before T3 model initialization
- Support 'as-is' format handling for mixed .pt/.safetensors community models
2026-01-25 01:20:30 -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 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 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 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 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 93aac7fc5b Fix streaming cache consistency between traditional and streaming modes
Root cause: WorkItem dataclass missing critical fields causing streaming workers to use hardcoded defaults instead of user parameters.

Key fixes:
- Add missing fields to WorkItem: seed, enable_audio_cache, crash_protection_template, device
- Update worker inputs to use WorkItem fields instead of hardcoded values
- Fix WorkItem creation to populate all fields from original inputs
- Remove local: prefix handling in language_mapper for consistency
- Add comprehensive language normalization in character_parser
- Comment out verbose cache debug logs while keeping success messages

Now both traditional (batch_size=0) and streaming (batch_size=3) modes generate identical cache keys with same parameters, ensuring proper cache hits and avoiding duplicate processing.

Streaming parallelization system now fully functional with cache consistency.
2025-08-10 00:52:27 -03:00
diodiogod b51292ef51 Fix language mapper to handle local models and character parser language assignment
- Language mapper now passes through local models (e.g., 'local:German') directly
- Character parser handles ChatterBox language codes properly vs F5-TTS model names
- This should fix narrator segments using correct main language selection
2025-08-09 23:52:05 -03:00
diodiogod e686ed1778 Version 4.2.2
Remove IndicF5-Hindi model support due to architecture incompatibility

IndicF5 uses custom transformer layers incompatible with F5-TTS DiT architecture.
Model weights cannot be loaded due to different layer structure (time_embed.time_mlp,
text_embed.text_blocks vs standard F5-TTS layers).

- Removed IndicF5Engine and all references
- Updated language mappings to fall back to base F5TTS models
- F5-Hindi-Small remains available as Hindi TTS alternative
2025-08-08 19:15:17 -03:00
diodiogod 9358401ae3 Add comprehensive F5-TTS Hindi and multilingual support with flexible architecture
Major Features:
• Added F5-Hindi-Small (632MB) and IndicF5-Hindi (1.4GB) models with auto-download
• Added support for 11 Indian languages: Hindi, Assamese, Bengali, Gujarati, Kannada, Malayalam, Marathi, Odia, Punjabi, Tamil, Telugu
• Added flexible Small model architecture detection (768 dim, 18 layers) vs Base (1024 dim, 22 layers)
• Enhanced fallback directory support: models/F5-TTS/ (primary) and models/Checkpoints/F5-TTS/ (fallback)

Architecture Improvements:
• Replaced hardcoded language detection with dynamic language mapper integration
• Added flexible model size detection for any future Small variants (155M params)
• Fixed language switching logic to only switch on explicit [lang:character] tags
• Added comprehensive Indian language aliases with native scripts

Bug Fixes:
• Fixed model loading errors for Hindi models using correct step numbers and file paths
• Fixed language switching detection to check original text instead of processed segments
• Fixed Small model architecture mismatch (18 vs 22 layers) with proper config detection
• Updated README with accurate model sizes and new Hindi options

Technical Details:
• F5-Hindi-Small: SPRINGLab/F5-Hindi-24KHz, model_2500000.safetensors, F5TTS_Small config
• IndicF5-Hindi: AI4Bharat/IndicF5, model.safetensors, supports 11 Indian languages
• Enhanced language_mapper.py with all 11 Indian languages pointing to appropriate models
• Improved character_parser.py with dynamic language inference from models
2025-08-08 17:10:49 -03:00
diodiogod a440cd05b0 Fix model loading efficiency and language mapping issues
- Implement generic local-first fallback utility for all TTS engines
- Fix ChatterBox and F5-TTS duplicate model loading during language fallback
- Add F5-TTS language grouping to load models once per language group
- Fix pt-br language mapping support in language mapper
- Add model tracking to prevent redundant loading in multilingual engine
- Optimize SRT nodes to use unified language-grouped processing

This ensures efficient model loading with proper local model reuse,
eliminating unnecessary downloads and duplicate model loading for
low-VRAM scenarios while maintaining full language support.
2025-08-06 23:01:20 -03:00
diodiogod 729cfa02a7 Fix F5-TTS model switching issue for English character switching
- Language mapper was hardcoding English to F5TTS_v1_Base regardless of engine config
- Now respects engine's configured model for English when it's an English model
- Prevents unnecessary model switching during character switching
- Engine configured with F5TTS_Base will now stay on F5TTS_Base for English characters
- Maintains fallback to F5TTS_v1_Base for non-English default models
2025-08-06 18:47:27 -03:00
diodiogod 1592e8a17f Version 3.4.3: Fix language switching bug and add flexible language aliases 2025-08-05 02:54:00 -03:00
diodiogod b21d0212fb Major refactoring: Reorganize project structure for better maintainability
🔧 ENGINES SEPARATION:
- Move chatterbox/ → engines/chatterbox/ (TTS/VC engine + models)
- Move chatterbox/f5tts/ → engines/f5tts/ (F5-TTS engine)
- Move adapters/ → engines/adapters/ (engine adapters for multilingual system)

📁 NODES ORGANIZATION:
- Create nodes/chatterbox/ for ChatterBox nodes (TTS, VC, SRT)
- Create nodes/f5tts/ for F5-TTS nodes (TTS, SRT, Edit, Options)
- Create nodes/audio/ for audio processing nodes (analyzer, recorder)
- Create nodes/base/ for base classes
- Rename node files for clarity (tts_node.py → chatterbox_tts_node.py)

🗂️ UTILITIES RESTRUCTURE:
- Replace core/ with organized utils/ structure
- utils/audio/ - Audio processing, analysis, caching
- utils/text/ - Text processing, character parsing, chunking
- utils/voice/ - Voice discovery, multilingual engine
- utils/timing/ - SRT timing logic (from chatterbox_srt/)
- utils/models/ - Model management (ChatterBox + F5-TTS)
- utils/system/ - System utilities, import management

🔄 IMPORT PATH UPDATES:
- Update all import paths to use new organized structure
- Fix lazy imports in nodes for runtime compatibility
- Restore missing F5-TTS edit engine from git history
- Fix path resolution for voice discovery and character aliases

🎯 KEY IMPROVEMENTS:
- Engine-centric organization with clear separation
- Purpose-driven folder grouping for better navigation
- Self-documenting file names indicating ownership
- Scalable structure for future engine additions
- Maintains backward compatibility for existing workflows

All 10 nodes loading successfully with complete functionality preserved.
2025-08-02 18:50:26 -03:00