`chatterbox_node.py` did `torch.load = patched_torch_load` at import time,
which replaces torch.load for the entire Python process — ComfyUI core and
every other custom node pack included.
Two problems in a shared environment (and on multi-tenant cloud runtimes
where one process serves many users' jobs back to back):
1. Cross-pack clobbering. Other packs also wrap `torch.load`. Whichever
imports last wins, so process-wide torch.load behavior depends on
custom-node import order, which is not deterministic.
2. Behavior imposed on unrelated callers. After import, every `torch.load`
in the process gets `map_location` forced onto it — including ComfyUI
core's checkpoint loading and other packs that explicitly wanted default
device placement.
Fix: keep `patched_torch_load` exactly as-is, but install it only for the
duration of this pack's own Chatterbox model loads via a
`default_map_location()` context manager, restoring the previous torch.load
in `finally`. All four `Chatterbox*.from_local(...)` call sites are wrapped,
so device defaulting still works for every Chatterbox load; torch.load is
left untouched for everyone else.
No functional change to how this pack loads models; only the blast radius of
the patch is reduced from process-global to call-scoped.
Add silence trimming workaround for known upstream Chatterbox multilingual
model issue where generated audio contains excessive trailing silence/noise.
This is a known issue in the official Chatterbox repo:
- https://github.com/resemble-ai/chatterbox/issues/287
- https://github.com/resemble-ai/chatterbox/issues/264
The fix trims trailing silence using RMS energy analysis with a -40dB
threshold and 100ms buffer to preserve natural speech endings.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The VC model loader was downloading incorrect model files (s3gen.safetensors)
when the ChatterboxVC.from_local() expects s3gen.pt format.
This caused the model to fail silently, resulting in empty/silent audio output.
Fixes#47
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fixes#45 - FL Chatterbox Turbo returns error (meanflow parameter)
Fixes#44 - Multilingual TTS min_p parameter compatibility
Changes:
- Add meanflow support to S3Gen for Turbo model (s3gen.py, flow.py, flow_matching.py, decoder.py)
- Add n_cfm_timesteps, noised_mels, speech_token_lens parameters throughout inference chain
- Add basic_euler solver for meanflow mode in flow_matching.py
- Add min_p parameter support to T3.inference() for Multilingual TTS (t3.py)
- Add MinPLogitsWarper for min_p sampling
- Fix Float vs Double type errors (librosa returns float64, PyTorch expects float32)
- Fix int vs float type errors in mask.py and flow.py
- Add save_audio_wav() helper with fallbacks for robust audio saving
- Add intmeanflow time mixer and configs for meanflow support
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Disabled AlignmentStreamAnalyzer which was causing "'NoneType' object
has no attribute 'cpu'" errors. The analyzer requires attention weights
via output_attentions=True, which is incompatible with SDPA (the default
attention implementation in newer transformers versions).
Since the analyzer's step() method was already commented out and unused,
this change has no functional impact on TTS generation.
Fixes issues related to:
- 'NoneType' object has no attribute 'cpu' errors
- No audio output / 0-second audio files
- TTS not working while VC works
See: https://github.com/resemble-ai/chatterbox/issues/106🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>