Skip to content

TypeError: 'NoneType' object is not callable when initializing ChatterboxTTS #198

@biraj-outspeed

Description

@biraj-outspeed

TypeError: 'NoneType' object is not callable when initializing ChatterboxTTS

Environment

  • Setup via uv.
  • Python 3.11
  • AWS g5.2xlarge instance (A10G GPU)
  • Ubuntu with CUDA available
  • chatterbox-tts installed via uv.

nvcc --version

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Fri_Jan__6_16:45:21_PST_2023
Cuda compilation tools, release 12.0, V12.0.140
Build cuda_12.0.r12.0/compiler.32267302_0

Issue

ChatterboxTTS.from_pretrained() fails with TypeError: 'NoneType' object is not callable

Error Traceback

Using device: cuda
/home/ubuntu/biraj/chatterbox/.venv/lib/python3.11/site-packages/diffusers/models/lora.py:393: FutureWarning: `LoRACompatibleLinear` is deprecated and will be removed in version 1.0.0. Use of `LoRACompatibleLinear` is deprecated. Please switch to PEFT backend by installing PEFT: `pip install peft`.
  deprecate("LoRACompatibleLinear", "1.0.0", deprecation_message)
Traceback (most recent call last):
  File "/home/ubuntu/biraj/chatterbox/main.py", line 15, in <module>
    model = ChatterboxTTS.from_pretrained(device=device)  # this is failing
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/biraj/chatterbox/.venv/lib/python3.11/site-packages/chatterbox/tts.py", line 180, in from_pretrained
    return cls.from_local(Path(local_path).parent, device)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/biraj/chatterbox/.venv/lib/python3.11/site-packages/chatterbox/tts.py", line 165, in from_local
    return cls(t3, s3gen, ve, tokenizer, device, conds=conds)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/biraj/chatterbox/.venv/lib/python3.11/site-packages/chatterbox/tts.py", line 126, in __init__
    self.watermarker = perth.PerthImplicitWatermarker()
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not callable

Code

import torch
import torchaudio as ta
from chatterbox.tts import ChatterboxTTS

# Automatically detect the best available device
if torch.cuda.is_available():
    device = "cuda"
elif torch.backends.mps.is_available():
    device = "mps"
else:
    device = "cpu"

print(f"Using device: {device}")

model = ChatterboxTTS.from_pretrained(device=device)  # this is failing

text = "Ezreal and Jinx teamed up with Ahri, Yasuo, and Teemo to take down the enemy's Nexus in an epic late-game pentakill."
wav = model.generate(text)
ta.save("test-1.wav", wav, model.sr)

Investigation

The issue appears to be with the perth library. While perth is installed and importable, perth.PerthImplicitWatermarker returns None:

Investigation code:

import perth

print(dir(perth))
print(perth.PerthImplicitWatermarker)

output:

['DummyWatermarker', 'PerthImplicitWatermarker', 'WatermarkerBase', 'WatermarkingException', '__all__', '__author__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '__version__', 'dummy_watermarker', 'watermarker']
None

As you can see, PerthImplicitWatermarker shows up on dir(perth), but is None when accessed.

I also faced the same issue when I ran the mac example on my macbook with M3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions