Google Colab

#13
by Pro2122 - opened

how to run this on google colab?

Did anyone find a way to run this on Google Colab?

I managed to make it work:

Specify the runtime version 2025.07 (because you need Python 11).

!pip install -q "numpy==1.25.2"

--- restart the session ---

import numpy as np
print(np.__version__) # Verify numpy is 1.25.2 (otherwise this will not work)
!python --version
# Install chatterbox-tts ignoring numpy requirement
!pip install -q chatterbox-tts --no-deps


# Install other dependencies manually
!pip install -q torch==2.6.0 \
                torchaudio==2.6.0 \
                librosa==0.11.0 \
                resemble-perth==1.0.1 \
                s3tokenizer \
                conformer==0.3.2 \
                transformers==4.46.3 \
                diffusers==0.29.0 \
                safetensors==0.5.3 \
                spacy-pkuseg \
                pykakasi==2.3.0 \
                gradio==5.44.1 \
                pyloudnorm \
                omegaconf


# Test if it works
import torchaudio as ta
import torch
from chatterbox.tts import ChatterboxTTS
from chatterbox.mtl_tts import ChatterboxMultilingualTTS
print("Success!")
model = ChatterboxTTS.from_pretrained(device = "cuda")

# Multilingual examples
multilingual_model = ChatterboxMultilingualTTS.from_pretrained(device = "cuda")

spanish_text = "Hola, ¿cómo estás? Mucho tiempo sin vernos. ¿Cómo está tu familia?"
wav_spanish = multilingual_model.generate(spanish_text, language_id="es")
ta.save("test-spanish.wav", wav_spanish, model.sr)
print("Success!")

Sign up or log in to comment