Chatterbox-TTS-Server
Chatterbox-TTS-Server copied to clipboard
Maximum recursion depth reached
Midway through a 300,000 char chunked synthesis:
chatterbox-tts-server-1 | 2025-06-25 14:17:43 [ERROR] engine: Error during TTS synthesis: maximum recursion depth exceeded
chatterbox-tts-server-1 | Traceback (most recent call last):
chatterbox-tts-server-1 | File "/app/engine.py", line 214, in synthesize
chatterbox-tts-server-1 | wav_tensor = chatterbox_model.generate(
chatterbox-tts-server-1 | File "/usr/local/lib/python3.10/dist-packages/chatterbox/tts.py", line 243, in generate
chatterbox-tts-server-1 | speech_tokens = self.t3.inference(
chatterbox-tts-server-1 | File "/usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py", line 116, in decorate_context
chatterbox-tts-server-1 | return func(*args, **kwargs)
chatterbox-tts-server-1 | File "/usr/local/lib/python3.10/dist-packages/chatterbox/models/t3/t3.py", line 318, in inference
chatterbox-tts-server-1 | output = self.patched_model(
chatterbox-tts-server-1 | File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1736, in _wrapped_call_impl
chatterbox-tts-server-1 | return self._call_impl(*args, **kwargs)
chatterbox-tts-server-1 | File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1747, in _call_impl
chatterbox-tts-server-1 | return forward_call(*args, **kwargs)
chatterbox-tts-server-1 | File "/usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py", line 116, in decorate_context
chatterbox-tts-server-1 | return func(*args, **kwargs)
chatterbox-tts-server-1 | File "/usr/local/lib/python3.10/dist-packages/chatterbox/models/t3/inference/t3_hf_backend.py", line 95, in forward
chatterbox-tts-server-1 | tfmr_out = self.model(
chatterbox-tts-server-1 | File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1736, in _wrapped_call_impl
chatterbox-tts-server-1 | return self._call_impl(*args, **kwargs)
chatterbox-tts-server-1 | File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1747, in _call_impl
chatterbox-tts-server-1 | return forward_call(*args, **kwargs)
chatterbox-tts-server-1 | File "/usr/local/lib/python3.10/dist-packages/transformers/models/llama/modeling_llama.py", line 945, in forward
chatterbox-tts-server-1 | layer_outputs = decoder_layer(
chatterbox-tts-server-1 | File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1736, in _wrapped_call_impl
chatterbox-tts-server-1 | return self._call_impl(*args, **kwargs)
chatterbox-tts-server-1 | File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1747, in _call_impl
chatterbox-tts-server-1 | return forward_call(*args, **kwargs)
chatterbox-tts-server-1 | File "/usr/local/lib/python3.10/dist-packages/transformers/models/llama/modeling_llama.py", line 676, in forward
chatterbox-tts-server-1 | hidden_states, self_attn_weights, present_key_value = self.self_attn(
chatterbox-tts-server-1 | File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1736, in _wrapped_call_impl
chatterbox-tts-server-1 | return self._call_impl(*args, **kwargs)
chatterbox-tts-server-1 | File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1844, in _call_impl
chatterbox-tts-server-1 | return inner()
chatterbox-tts-server-1 | File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1790, in inner
chatterbox-tts-server-1 | result = forward_call(*args, **kwargs)
chatterbox-tts-server-1 | File "/usr/local/lib/python3.10/dist-packages/chatterbox/models/t3/inference/alignment_stream_analyzer.py", line 84, in patched_forward
chatterbox-tts-server-1 | return original_forward(*args, **kwargs)
chatterbox-tts-server-1 | File "/usr/local/lib/python3.10/dist-packages/chatterbox/models/t3/inference/alignment_stream_analyzer.py", line 84, in patched_forward
chatterbox-tts-server-1 | return original_forward(*args, **kwargs)
chatterbox-tts-server-1 | File "/usr/local/lib/python3.10/dist-packages/chatterbox/models/t3/inference/alignment_stream_analyzer.py", line 84, in patched_forward
chatterbox-tts-server-1 | return original_forward(*args, **kwargs)
chatterbox-tts-server-1 | [Previous line repeated 946 more times]
chatterbox-tts-server-1 | File "/usr/local/lib/python3.10/dist-packages/transformers/models/llama/modeling_llama.py", line 546, in forward
chatterbox-tts-server-1 | return super().forward(
chatterbox-tts-server-1 | File "/usr/local/lib/python3.10/dist-packages/transformers/models/llama/modeling_llama.py", line 339, in forward
chatterbox-tts-server-1 | query_states = self.q_proj(hidden_states)
chatterbox-tts-server-1 | File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1736, in _wrapped_call_impl
chatterbox-tts-server-1 | return self._call_impl(*args, **kwargs)
chatterbox-tts-server-1 | File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1747, in _call_impl
chatterbox-tts-server-1 | return forward_call(*args, **kwargs)
chatterbox-tts-server-1 | File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/linear.py", line 125, in forward
chatterbox-tts-server-1 | return F.linear(input, self.weight, self.bias)
chatterbox-tts-server-1 | RecursionError: maximum recursion depth exceeded
chatterbox-tts-server-1 | 2025-06-25 14:17:43 [ERROR] server: TTS engine failed to synthesize audio for chunk 845.
chatterbox-tts-server-1 | 2025-06-25 14:56:29 [INFO] server: Request received for /api/ui/initial-data.
chatterbox-tts-server-1 | 2025-06-25 14:56:29 [INFO] utils: Found 37 predefined voices in /app/voices
As a workaround, if you have another long text to process, restarting the server between each job will reset the model's state and prevent the error from occurring.
I'll keep this issue updated with my progress on a permanent patch. Thanks again for finding and reporting this