Chatterbox-TTS-Server icon indicating copy to clipboard operation
Chatterbox-TTS-Server copied to clipboard

Docker with 5090 not working (AttributeError: module 'torch.nn' has no attribute 'Module')

Open tudorms opened this issue 9 months ago • 3 comments

Hi,

I tried both the default and the -cu128 docker compose variants on Docker Desktop (Windows 11 WSL2) and neither appears to work. These are the logs for the default docker compose:

2026-02-05 22:11:11.924 | 
2026-02-05 22:11:11.924 | ==========
2026-02-05 22:11:11.924 | == CUDA ==
2026-02-05 22:11:11.924 | ==========
2026-02-05 22:11:11.925 | 
2026-02-05 22:11:11.925 | CUDA Version 12.8.1
2026-02-05 22:11:11.926 | 
2026-02-05 22:11:11.926 | Container image Copyright (c) 2016-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2026-02-05 22:11:11.926 | 
2026-02-05 22:11:11.926 | This container image and its contents are governed by the NVIDIA Deep Learning Container License.
2026-02-05 22:11:11.926 | By pulling and using the container, you accept the terms and conditions of this license:
2026-02-05 22:11:11.926 | https://developer.nvidia.com/ngc/nvidia-deep-learning-container-license
2026-02-05 22:11:11.926 | 
2026-02-05 22:11:11.926 | A copy of this license is made available in this container at /NGC-DL-CONTAINER-LICENSE for your convenience.
2026-02-05 22:11:11.930 | 
2026-02-05 22:11:15.337 | 2026-02-06 06:11:15 [INFO] __main__: Starting TTS Server directly on http://0.0.0.0:8004
2026-02-05 22:11:15.338 | 2026-02-06 06:11:15 [INFO] __main__: API documentation will be available at http://0.0.0.0:8004/docs
2026-02-05 22:11:15.338 | 2026-02-06 06:11:15 [INFO] __main__: Web UI will be available at http://0.0.0.0:8004/
2026-02-05 22:11:15.371 | INFO:     Started server process [1]
2026-02-05 22:11:15.371 | INFO:     Waiting for application startup.
2026-02-05 22:11:15.373 | 2026-02-06 06:11:15 [INFO] server: TTS Server: Initializing application...
2026-02-05 22:11:15.374 | 2026-02-06 06:11:15 [INFO] server: Configuration loaded. Log file at: /app/logs/tts_server.log
2026-02-05 22:11:15.560 | /usr/local/lib/python3.10/dist-packages/torch/cuda/__init__.py:235: UserWarning: 
2026-02-05 22:11:15.560 | NVIDIA GeForce RTX 5090 with CUDA capability sm_120 is not compatible with the current PyTorch installation.
2026-02-05 22:11:15.560 | The current PyTorch install supports CUDA capabilities sm_50 sm_60 sm_70 sm_75 sm_80 sm_86 sm_90.
2026-02-05 22:11:15.560 | If you want to use the NVIDIA GeForce RTX 5090 GPU with PyTorch, please check the instructions at https://pytorch.org/get-started/locally/
2026-02-05 22:11:15.560 | 
2026-02-05 22:11:15.560 |   warnings.warn(
2026-02-05 22:11:15.769 | 2026-02-06 06:11:15 [INFO] engine: CUDA requested and functional. Using CUDA.
2026-02-05 22:11:15.770 | 2026-02-06 06:11:15 [INFO] engine: Final device selection: cuda
2026-02-05 22:11:15.770 | 2026-02-06 06:11:15 [INFO] engine: Model selector from config: 'chatterbox-turbo'
2026-02-05 22:11:15.771 | 2026-02-06 06:11:15 [INFO] engine: Model selector 'chatterbox-turbo' resolved to Turbo model (ChatterboxTurboTTS)
2026-02-05 22:11:15.771 | 2026-02-06 06:11:15 [INFO] engine: Initializing ChatterboxTurboTTS on device 'cuda'...
2026-02-05 22:11:15.772 | 2026-02-06 06:11:15 [INFO] engine: Model type: turbo
2026-02-05 22:11:15.772 | 2026-02-06 06:11:15 [INFO] engine: Turbo model supports paralinguistic tags: ['laugh', 'chuckle', 'sigh', 'gasp', 'cough', 'clear throat', 'sniff', 'groan', 'shush']
2026-02-05 22:12:02.496 | 2026-02-06 06:12:02 [ERROR] engine: Failed to load model using from_pretrained: CUDA error: no kernel image is available for execution on the device
2026-02-05 22:12:02.496 | CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.
2026-02-05 22:12:02.496 | For debugging consider passing CUDA_LAUNCH_BLOCKING=1
2026-02-05 22:12:02.496 | Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions.
2026-02-05 22:12:02.496 | Traceback (most recent call last):
2026-02-05 22:12:02.496 |   File "/app/engine.py", line 292, in load_model
2026-02-05 22:12:02.496 |     chatterbox_model = model_class.from_pretrained(device=model_device)
2026-02-05 22:12:02.496 |   File "/usr/local/lib/python3.10/dist-packages/chatterbox/tts_turbo.py", line 202, in from_pretrained
2026-02-05 22:12:02.496 |     return cls.from_local(local_path, device)
2026-02-05 22:12:02.496 |   File "/usr/local/lib/python3.10/dist-packages/chatterbox/tts_turbo.py", line 146, in from_local
2026-02-05 22:12:02.496 |     ve.to(device).eval()
2026-02-05 22:12:02.496 |   File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1340, in to
2026-02-05 22:12:02.496 |     return self._apply(convert)
2026-02-05 22:12:02.496 |   File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 900, in _apply
2026-02-05 22:12:02.496 |     module._apply(fn)
2026-02-05 22:12:02.496 |   File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/rnn.py", line 288, in _apply
2026-02-05 22:12:02.496 |     self._init_flat_weights()
2026-02-05 22:12:02.496 |   File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/rnn.py", line 215, in _init_flat_weights
2026-02-05 22:12:02.496 |     self.flatten_parameters()
2026-02-05 22:12:02.496 |   File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/rnn.py", line 269, in flatten_parameters
2026-02-05 22:12:02.496 |     torch._cudnn_rnn_flatten_weight(
2026-02-05 22:12:02.496 | RuntimeError: CUDA error: no kernel image is available for execution on the device
2026-02-05 22:12:02.496 | CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.
2026-02-05 22:12:02.496 | For debugging consider passing CUDA_LAUNCH_BLOCKING=1
2026-02-05 22:12:02.496 | Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions.
2026-02-05 22:12:02.496 | 
2026-02-05 22:12:02.496 | 2026-02-06 06:12:02 [CRITICAL] server: CRITICAL: TTS Model failed to load on startup. Server might not function correctly.
2026-02-05 22:12:02.497 | 2026-02-06 06:12:02 [INFO] server: Application startup sequence complete.
2026-02-05 22:12:02.497 | INFO:     Application startup complete.
2026-02-05 22:12:02.499 | INFO:     Uvicorn running on http://0.0.0.0:8004 (Press CTRL+C to quit)

And these are the logs for the -cu128 docker compose (which keeps restarting in a loop):

2026-02-05 22:18:48.805 | 
2026-02-05 22:18:48.805 | ==========
2026-02-05 22:18:48.805 | == CUDA ==
2026-02-05 22:18:48.805 | ==========
2026-02-05 22:18:48.806 | 
2026-02-05 22:18:48.806 | CUDA Version 12.8.1
2026-02-05 22:18:48.807 | 
2026-02-05 22:18:48.807 | Container image Copyright (c) 2016-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2026-02-05 22:18:48.807 | 
2026-02-05 22:18:48.807 | This container image and its contents are governed by the NVIDIA Deep Learning Container License.
2026-02-05 22:18:48.807 | By pulling and using the container, you accept the terms and conditions of this license:
2026-02-05 22:18:48.807 | https://developer.nvidia.com/ngc/nvidia-deep-learning-container-license
2026-02-05 22:18:48.807 | 
2026-02-05 22:18:48.807 | A copy of this license is made available in this container at /NGC-DL-CONTAINER-LICENSE for your convenience.
2026-02-05 22:18:48.811 | 
2026-02-05 22:18:51.704 | Traceback (most recent call last):
2026-02-05 22:18:51.704 |   File "/app/server.py", line 62, in <module>
2026-02-05 22:18:51.704 |     import engine  # TTS Engine interface
2026-02-05 22:18:51.704 |   File "/app/engine.py", line 12, in <module>
2026-02-05 22:18:51.704 |     from chatterbox.tts import ChatterboxTTS  # Main TTS engine class
2026-02-05 22:18:51.704 |   File "/usr/local/lib/python3.10/dist-packages/chatterbox/__init__.py", line 9, in <module>
2026-02-05 22:18:51.704 |     from .tts import ChatterboxTTS
2026-02-05 22:18:51.704 |   File "/usr/local/lib/python3.10/dist-packages/chatterbox/tts.py", line 6, in <module>
2026-02-05 22:18:51.704 |     import perth
2026-02-05 22:18:51.704 |   File "/usr/local/lib/python3.10/dist-packages/perth/__init__.py", line 13, in <module>
2026-02-05 22:18:51.704 |     from .perth_net.perth_net_implicit.perth_watermarker import PerthImplicitWatermarker
2026-02-05 22:18:51.704 |   File "/usr/local/lib/python3.10/dist-packages/perth/perth_net/__init__.py", line 4, in <module>
2026-02-05 22:18:51.704 |     from .perth_net_implicit.perth_watermarker import PerthImplicitWatermarker
2026-02-05 22:18:51.704 |   File "/usr/local/lib/python3.10/dist-packages/perth/perth_net/perth_net_implicit/perth_watermarker.py", line 5, in <module>
2026-02-05 22:18:51.704 |     from .model.perth_net import PerthNet
2026-02-05 22:18:51.704 |   File "/usr/local/lib/python3.10/dist-packages/perth/perth_net/perth_net_implicit/model/__init__.py", line 5, in <module>
2026-02-05 22:18:51.704 |     class Conv(nn.Module):
2026-02-05 22:18:51.704 | AttributeError: module 'torch.nn' has no attribute 'Module'
2026-02-05 22:18:52.926 | 
2026-02-05 22:18:52.926 | ==========
2026-02-05 22:18:52.926 | == CUDA ==
2026-02-05 22:18:52.926 | ==========
2026-02-05 22:18:52.927 | 
2026-02-05 22:18:52.927 | CUDA Version 12.8.1
2026-02-05 22:18:52.927 | 
2026-02-05 22:18:52.927 | Container image Copyright (c) 2016-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2026-02-05 22:18:52.928 | 
2026-02-05 22:18:52.928 | This container image and its contents are governed by the NVIDIA Deep Learning Container License.
2026-02-05 22:18:52.928 | By pulling and using the container, you accept the terms and conditions of this license:
2026-02-05 22:18:52.928 | https://developer.nvidia.com/ngc/nvidia-deep-learning-container-license
2026-02-05 22:18:52.928 | 
2026-02-05 22:18:52.928 | A copy of this license is made available in this container at /NGC-DL-CONTAINER-LICENSE for your convenience.
2026-02-05 22:18:52.932 | 
2026-02-05 22:18:53.785 | Traceback (most recent call last):
2026-02-05 22:18:53.785 |   File "/app/server.py", line 62, in <module>
2026-02-05 22:18:53.785 |     import engine  # TTS Engine interface
2026-02-05 22:18:53.785 |   File "/app/engine.py", line 12, in <module>
2026-02-05 22:18:53.785 |     from chatterbox.tts import ChatterboxTTS  # Main TTS engine class
2026-02-05 22:18:53.785 |   File "/usr/local/lib/python3.10/dist-packages/chatterbox/__init__.py", line 9, in <module>
2026-02-05 22:18:53.785 |     from .tts import ChatterboxTTS
2026-02-05 22:18:53.785 |   File "/usr/local/lib/python3.10/dist-packages/chatterbox/tts.py", line 6, in <module>
2026-02-05 22:18:53.785 |     import perth
2026-02-05 22:18:53.785 |   File "/usr/local/lib/python3.10/dist-packages/perth/__init__.py", line 13, in <module>
2026-02-05 22:18:53.785 |     from .perth_net.perth_net_implicit.perth_watermarker import PerthImplicitWatermarker
2026-02-05 22:18:53.785 |   File "/usr/local/lib/python3.10/dist-packages/perth/perth_net/__init__.py", line 4, in <module>
2026-02-05 22:18:53.785 |     from .perth_net_implicit.perth_watermarker import PerthImplicitWatermarker
2026-02-05 22:18:53.785 |   File "/usr/local/lib/python3.10/dist-packages/perth/perth_net/perth_net_implicit/perth_watermarker.py", line 5, in <module>
2026-02-05 22:18:53.785 |     from .model.perth_net import PerthNet
2026-02-05 22:18:53.785 |   File "/usr/local/lib/python3.10/dist-packages/perth/perth_net/perth_net_implicit/model/__init__.py", line 5, in <module>
2026-02-05 22:18:53.785 |     class Conv(nn.Module):
2026-02-05 22:18:53.785 | AttributeError: module 'torch.nn' has no attribute 'Module'
2026-02-05 22:18:55.095 | 

Any recommendations? Thanks!

tudorms avatar Feb 06 '26 06:02 tudorms

Add this code above 4th cell

%%bash

echo "Step 1 — Clone Perth repo"
cd /content
rm -rf perth
git clone https://github.com/resemble-ai/perth.git

echo "Step 2 — Install from local source"
/content/bin/micromamba run -n cb311 pip install ./perth

echo "Step 3 — Test import"
/content/bin/micromamba run -n cb311 python -c "import perth; print('OK:', dir(perth))"

Rajashekhar-Reddy avatar Feb 13 '26 08:02 Rajashekhar-Reddy

Fixed in commit b181edb. The Dockerfile.cu128 has been reworked — it now properly installs torch 2.9.0+cu128 and chatterbox with --no-deps. Rebuild with:

docker compose -f docker-compose-cu128.yml up -d --build

devnen avatar Mar 26 '26 21:03 devnen

Closing, fixed in b181edb. Dockerfile.cu128 now installs torch 2.9.0+cu128 and chatterbox with --no-deps correctly. There is also a newer docker-compose-cu130.yml if you want CUDA 13. Please reopen if you still hit it after a clean rebuild.

devnen avatar May 11 '26 14:05 devnen