Commit Graph
27 Commits
Author SHA1 Message Date
diodiogod 9081d3c22a Add Fish Audio S2 engine and fix VibeVoice speaker remap 2026-07-06 23:35:13 -03:00
diodiogod 025c7b09b6 Version 4.22.7
Fix Python 3.13 numba and librosa compatibility handling

Technical details:
- Stop forcing NUMBA_DISABLE_JIT at startup on Python 3.13
- Use safe audio loading and resampling in IndexTTS-2 and ChatterBox Official 23-Lang
- Update audio hashing and fallback paths for newer numba stacks
2026-03-13 12:34:46 -03:00
diodiogod dc0b84655b Version 4.22.1
fix: enforce numba.config.DISABLE_JIT when env var already set

- NUMBA_DISABLE_JIT=1 env var has no effect if numba is already imported
- When env var is present, now also set numba.config.DISABLE_JIT=True directly
- Fixes users where NUMBA_DISABLE_JIT was set but crash still occurred
2026-03-01 22:12:18 -03:00
diodiogod 675031fe07 Version 4.21.19
Fix: Use librosa.resample as numba JIT compatibility test instead of stft

- librosa.stft does not trigger librosa.core.audio lazy-load
- librosa.resample does, which is where @guvectorize crashes on NumPy 2.x
- This ensures the startup test actually catches the failure before engines run
2026-02-28 20:56:33 -03:00
diodiogod 2e43bfd9f7 Version 4.21.18
Fix: Restore Numba/librosa JIT compatibility test at startup for NumPy 2.x

- Restore full librosa JIT test at startup for NumPy 2.x environments
- PR 262 lazy-import optimization had deferred this test too late, after numba
  was already loaded, making NUMBA_DISABLE_JIT ineffective
- NumPy 1.x users still skip the test entirely (zero cost)
- Python 3.13+ still handled by preemptive env var (zero cost)
- Addresses get_call_template AttributeError crash in librosa on affected hardware
2026-02-28 09:28:17 -03:00
diodiogod 43f95bc723 Revert overzealous Numba global monkey-patch and deferred checking 2026-02-22 12:14:35 -03:00
diodiogod 3dad764d2c Fix: Add deferred rigorous Numba compilation testing and global librosa fallback patching to prevent catastrophic JIT typing errors on NumPy 2.x 2026-02-21 22:39:37 -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 a2360db51c Version 4.20.10
Address issue #249: Windows AMD ROCm torch.distributed.ReduceOp compatibility

Technical implementation:
- Add patch_torch_distributed_reduceop() to PyTorchPatches class
- Create stub ReduceOp class when missing from torch.distributed
- Inject stub early in startup before engine imports
- Enables single-GPU inference on Windows AMD ROCm 7.2 builds

This allows bundled engines (Step Audio EditX, Higgs Audio, IndexTTS, etc.) to import successfully even when PyTorch 2.9.1+rocmsdk20260116 has incomplete torch.distributed module.
2026-02-04 14:07:42 -03:00
diodiogod 72f10c96fd Version 4.20.9
Add Step Audio EditX Mac (MPS) compatibility patch

Technical details:
- Create centralized device compatibility patch system
- Monkey-patch hardcoded CUDA device calls in upsample_encoder_v2.py
- Detect device from model parameters instead of hardcoding
- Gracefully disable CUDA Graphs on non-CUDA devices (MPS/CPU)
- Apply patch automatically when Step Audio EditX engine loads

Addresses issue #245 (requires Mac user testing)
2026-02-04 00:36:35 -03:00
diodiogod fa74973ad5 Fix Qwen3-TTS audio hash error with nested dict structure
Fixed 'dict' object has no attribute 'cpu' error when using Voice Designer
voices with TTS Text node.

## Root Cause

Voice Designer and Character Voices nodes output unified NARRATOR_VOICE format:
{
    "audio": {"waveform": tensor, "sample_rate": 24000},
    "audio_path": "...",
    "reference_text": "...",
    ...
}

But TTS Text node was wrapping this AGAIN when creating voice_mapping:
{
    "waveform": audio_tensor,  # audio_tensor was already a dict!
    "sample_rate": 24000,
    "text": "..."
}

This created triple-nested structure that broke audio hashing.

## Fixes Applied

**TTS Text Node** (nodes/unified/tts_text_node.py):
- Extract actual waveform tensor from audio dict before creating voice_mapping
- Applied to all 6 places where audio_tensor is used:
  - Narrator voice mapping (line 1151)
  - Character ICL fallback (line 1183)
  - Character x_vector fallback (line 1217)
  - Character no-text fallback (line 1220)
  - Character no-audio fallback (line 1237)
- Pattern: Check if audio_tensor is dict, extract waveform/sample_rate if so

**Qwen3-TTS Adapter** (engines/adapters/qwen3_tts_adapter.py):
- Extract inner audio dict before passing to hash function
- Changed from passing full voice_ref to passing voice_ref['audio']

**Audio Hash Utility** (utils/audio/audio_hash.py):
- Added nested structure handling with fallback
- Detects Character Voices format {"audio": {...}} vs direct format
- Enhanced debug logging to diagnose structure issues

## Testing

- Voice Designer → TTS Text: Works without hash error
- Character Voices → TTS Text: Works without hash error
- Audio hashing generates stable keys for caching
- Both VoiceDesign and traditional voices function correctly
2026-01-28 00:15:21 -03:00
diodiogod 35d216e95b Remove verbose patch summary messages
Only print individual patch application messages when patches are actually
applied (when verbose=True in each specific patch method). Removes noisy
summary messages like 'Applied 4 transformers compatibility patches' that
provide no actionable information.
2025-12-05 13:02:18 -03:00
diodiogod 0cfed8d23c Disable Step Audio EditX tokenization patch - fixed via config.json
The transformers 4.54+ compatibility issue is now resolved by setting
tie_word_embeddings=false in the model config.json. The monkey-patch
workaround is no longer needed.
2025-12-05 12:57:07 -03:00
diodiogod 4788d0347e Reduce verbosity of compatibility patches init output
Remove unnecessary progress messages during patch application.
Now only shows summary counts unless there are errors.
2025-12-03 23:41:04 -03:00
diodiogod 4ed2a36aef Fix Step Audio EditX transformers 4.54+ compatibility
Fixes critical bug where transformers 4.54+ incorrectly ties lm_head weights
to embed_tokens, causing Step Audio EditX to generate text tokens instead of
audio tokens (silent/gibberish output).

Root cause:
- Transformers 4.54+ ties lm_head to embed_tokens even when checkpoint has different values
- Step-Audio-EditX has lm_head (norm=227) and embed_tokens (norm=255) as separate weights
- Tying overwrites correct lm_head, breaking audio generation

Changes:
- model_loader.py: Add workaround to restore correct lm_head weights after loading
  - Detects incorrect weight tying by comparing data pointers
  - Loads correct lm_head.weight from safetensors
  - Works with transformers 4.54-4.57+
- Clean up debug code and console spam:
  - Remove torch_complex warnings (funasr_detach files)
  - Remove sox import and unused audio functions
  - Silence FunASR registration tables
  - Filter torchaudio deprecation warnings

Upstream fix:
- Submitted PR to transformers: https://github.com/huggingface/transformers/pull/42612
- Workaround will remain for backward compatibility with unfixed versions

Tested with transformers 4.57.3 - generates audio tokens correctly.
2025-12-03 23:18:39 -03:00
diodiogod efe8d295d4 Update comments to explain PyTorch 2.9 bug fixes comprehensively
- Clarify that global patch solves TWO issues: TorchCodec DLL + int16 normalization
- Explain timing criticality: patch must apply before torchaudio import
- Remove redundant pytorch_patches call from apply_all_compatibility_patches()
- Update save_audio_safe docstring to explain defense-in-depth approach
- Add detailed docstring to pytorch_patches explaining both issues and fixes
2025-11-07 03:30:36 -03:00
diodiogod ecde6be1c8 Fix PyTorch 2.9 TorchCodec patch timing - apply before any module imports torchaudio 2025-11-07 03:26:13 -03:00
diodiogod dff111889e Apply global PyTorch 2.9 TorchCodec monkey-patch at startup
Recreate pytorch_patches.py with proper global monkey-patching of torchaudio.save/load
to use scipy.io.wavfile instead of TorchCodec. This fixes 'Could not load libtorchcodec'
errors on Windows with PyTorch 2.9.0+cu128 without needing fixes in every file.

Changes:
- Global monkey-patch applied at startup via comfyui_compatibility.py
- Works for ALL code that uses torchaudio.save/load (recorder, voice changer, etc)
- No user setup required, no FFmpeg workarounds needed
- Pure Python scipy solution, no native dependencies

This is the proper fix for TorchCodec Windows incompatibility with PyTorch 2.9.
2025-11-07 03:11:33 -03:00
diodiogod 7b7ce5793a Remove unused pytorch_patches.py - fix was in Character Voices normalization
The pytorch_patches.py file was created to globally monkey-patch torchaudio.save/load
but was never actually applied anywhere. The real fix was normalizing int16 to float
in the Character Voices node after PyTorch 2.9 changed torchaudio.load() behavior.

Since the fix is now working and pytorch_patches.py is unused dead code, remove it.
2025-11-07 02:56:30 -03:00
diodiogod f723d6a352 Clean up PyTorch patches: remove ineffective BigVGAN/S2Mel patches, keep TorchCodec fix only 2025-11-07 00:48:33 -03:00
diodiogod 5138cab267 Fix PyTorch 2.9.0+cu128 TorchCodec incompatibility
- Create pytorch_patches.py module for PyTorch/TorchAudio compatibility
- Patch torchaudio.save() and load() to use soundfile for WAV files
- Fixes 'Could not load libtorchcodec' errors on Windows with PyTorch 2.9+
- Only applies patch on PyTorch 2.9+, safe fallback for other versions
- Apply patch in IndexTTS engine before torchaudio operations
2025-11-06 23:31:48 -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 df4ef85579 Version 4.9.25
Fix transformers compatibility handling

Technical changes:
- Disable legacy DynamicCache patches that masked version conflicts
- Add startup version check for transformers >=4.51.3
- Provide clear upgrade instructions for users with old transformers
- Remove automatic compatibility patches from VibeVoice engine
2025-09-21 23:58:45 -03:00
diodiogod f35395a072 Version 4.8.30
Fix VibeVoice cache invalidation and DynamicCache compatibility

Technical details:
- Add inference_steps parameter to VibeVoice cache key generator
- Disable deprecated transformers compatibility patches causing DynamicCache errors
- Add targeted DynamicCache key_cache/value_cache properties for VibeVoice compatibility
- Fix cache not invalidating when changing diffusion inference steps
2025-09-09 14:35:23 -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 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 08ce943f4f Centralize transformers compatibility patches into unified system
- Created utils/compatibility/transformers_patches.py with all monkey patches
- Moved FlashAttentionKwargs, BaseStreamer, DynamicCache, and generation method patches
- Fixed VibeVoice GenerationMixin._prepare_generation_config signature compatibility
- Updated VibeVoice downloader and engine to use centralized patches
- Updated PROJECT_INDEX.md to document compatibility system
- Eliminates duplicate patching logic and improves maintainability
2025-09-07 09:06:27 -03:00