Skip to content

ChatterboxTurboTTS fails with RuntimeError: expected scalar type Double but found Float when specifying audio_prompt_path when numpy>=2.0 #499

@felixgwilliams

Description

@felixgwilliams

When running the following code, I get an error due to a mismatch between float types

tts_model = ChatterboxTurboTTS.from_pretrained(device="cuda")

text = "Whereas recognition of the inherent dignity and of the equal and inalienable rights..."
wav = tts_model.generate(
    text,
    audio_prompt_path="voice_example.wav",
)

I am running this on python 3.13, so I have numpy>2.4.4 installed. I think the issue is in

wav = wav * gain_linear

gain_linear is a np.float64 and due to the new type promotion rules, this promotes wav from an np.float32 to a np.float64.

In my use case, it's good enough to cast gain_linear to np.float32, but there may be more places where promotions happen.

I'll raise a pull request.

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