Apple Silicon error
Hello,
I am getting the error below when generating speech on Apple Silicon MPS. Anyone able to get it working on Apple Silicon?
Hardware: M4 Max, 128GB RAM Software: Sequoia 15.4.1, Torch/Torchaudio 2.7.0
Error in decode method: Calculated padded input size per channel: (0). Kernel size: (1). Kernel size can't be greater than actual input size 2025-04-29 22:47:45,620 [ERROR] engine: Error calling model.generate() for chunk 4: Calculated padded input size per channel: (0). Kernel size: (1). Kernel size can't be greater than actual input size Traceback (most recent call last): File "/Users/Py/dia-tts-server/engine.py", line 782, in generate_speech chunk_output_np = dia_model.generate( ^^^^^^^^^^^^^^^^^^^ File "/Users/Py/miniconda3/envs/dia-tts/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/Users/Py/dia-tts-server/dia/model.py", line 621, in generate output = self._generate_output(generated_codes) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Py/dia-tts-server/dia/model.py", line 400, in _generate_output audio = decode(self.dac_model, codebook.transpose(1, 2)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Py/miniconda3/envs/dia-tts/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/Users/Py/miniconda3/envs/dia-tts/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/Users/Py/dia-tts-server/dia/audio.py", line 197, in decode audio_values = model.quantizer.from_codes(audio_codes) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Py/miniconda3/envs/dia-tts/lib/python3.12/site-packages/dac/nn/quantize.py", line 218, in from_codes z_q_i = self.quantizers[i].out_proj(z_p_i) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Py/miniconda3/envs/dia-tts/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1751, in _wrapped_call_impl return self._call_impl(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Py/miniconda3/envs/dia-tts/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1857, in _call_impl return inner() ^^^^^^^ File "/Users/Py/miniconda3/envs/dia-tts/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1805, in inner result = forward_call(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Py/miniconda3/envs/dia-tts/lib/python3.12/site-packages/torch/nn/modules/conv.py", line 375, in forward return self._conv_forward(input, self.weight, self.bias) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Py/miniconda3/envs/dia-tts/lib/python3.12/site-packages/torch/nn/modules/conv.py", line 370, in _conv_forward return F.conv1d( ^^^^^^^^^ RuntimeError: Calculated padded input size per channel: (0). Kernel size: (1). Kernel size can't be greater than actual input size
Thanks for the detailed report and error log. This Kernel size can't be greater than actual input size error during the DAC decoding step seems specific to running on Apple Silicon (MPS).
Unfortunately, I don't have M-series hardware to test and debug this MPS issue directly.
We'll keep this issue open in case others in the community using Apple Silicon have encountered this and can share insights or potential fixes. If anyone else on MPS has ideas, please chime in.
Thanks again for reporting it.
+1
Maybe this helps?
https://huggingface.co/mlx-community/Dia-1.6B-4bit
pip install -U mlx-audio
python -m mlx_audio.tts.generate --model mlx-community/Dia-1.6B-4bit --text "Describe this image."
Closing as stale (no follow-up for ~10 months). @jarmitage suggested the 4-bit MLX build at https://huggingface.co/mlx-community/Dia-1.6B-4bit via mlx-audio as a working alternative on Apple Silicon, which may be useful. Please open a new issue with current logs if you still hit it on the current code.