Model not loading in Chatterbox_TTS_Colab_Demo.ipynb (Active Model shows “Model not loaded”)
I Think there is an issue when opening and running Chatterbox_TTS_Colab_Demo.ipynb, either after downloading it to a local server or when running it in a web browser or Google Colab.
Expected behavior: The interface should load and function normally, with the model successfully initialized.
Actual behavior: In the Active Model field, the following message is displayed: “Model not loaded”
As a result, the interface does not appear to function as expected.
Thank you for your time and support. Please let me know if any additional information (logs, environment details, or steps to reproduce) is needed.
yes
This issue is probably due to the perth library not being in requirements. I thought some kind of pip install resemble-perth would fix the issue, but I wasn't able to. My very crude workaround was patching the code to remove perth. If someone is smarter maybe they can add the requirement or make the import work. My solution is to replace the 4th cell with
# @title 4. Install Server + Run With Full Live Logs (Patched Stable Version)
import os, subprocess, socket, requests, pathlib
from pathlib import Path
PORT = 8004
REPO_DIR = "/content/Chatterbox-TTS-Server"
LOG_STDOUT = "/content/chatterbox_server_stdout.log"
def sh(cmd, check=False):
return subprocess.run(["bash", "-lc", cmd], check=check)
def port_open(host="127.0.0.1", port=PORT, timeout=0.25):
try:
with socket.create_connection((host, port), timeout=timeout):
return True
except OSError:
return False
os.chdir("/content")
# Fresh clone
sh("rm -rf /content/Chatterbox-TTS-Server", check=False)
sh("git clone https://github.com/devnen/Chatterbox-TTS-Server.git", check=True)
os.chdir(REPO_DIR)
print("=== Quick system checks ===")
sh("nvidia-smi || true", check=False)
print("\n=== Installing server requirements ===")
if Path("requirements-nvidia.txt").exists():
sh("/content/bin/micromamba run -n cb311 pip install -U pip setuptools wheel", check=False)
sh("/content/bin/micromamba run -n cb311 pip install -r requirements-nvidia.txt", check=False)
else:
sh(
"/content/bin/micromamba run -n cb311 pip install -U pip setuptools wheel && "
"/content/bin/micromamba run -n cb311 pip install "
"fastapi 'uvicorn[standard]' pyyaml soundfile librosa safetensors "
"python-multipart requests jinja2 watchdog aiofiles unidecode inflect tqdm "
"pydub audiotsm praat-parselmouth peft",
check=False
)
# ---------------------------------------------------
# 🔧 PATCH: Disable Perth watermarker (fix Colab crash)
# ---------------------------------------------------
print("\n=== Patching chatterbox turbo (disable Perth watermarker) ===")
t3_file = pathlib.Path("/root/.local/share/mamba/envs/cb311/lib/python3.11/site-packages/chatterbox/tts_turbo.py")
if t3_file.exists():
text = t3_file.read_text()
if "PerthImplicitWatermarker" in text or "apply_watermark" in text:
text = text.replace(
"self.watermarker = perth.PerthImplicitWatermarker()",
"self.watermarker = None # Patched: disable Perth watermarker for Colab"
)
text = text.replace(
"self.watermarker.apply_watermark(wav, sample_rate=self.sr)",
"wav"
)
t3_file.write_text(text)
print("✓ Patched Perth watermarker in micromamba env")
else:
print("✓ Patch not needed")
else:
print("⚠ Could not locate tts_turbo.py in micromamba env")
# ---------------------------------------------------
print("\n=== Removing old stdout log ===")
Path(LOG_STDOUT).unlink(missing_ok=True)
print("\n=== Starting server with LIVE logs ===")
print("Log file:", LOG_STDOUT)
print("To stop the server, interrupt this cell.\n")
env = os.environ.copy()
env["PYTHONUNBUFFERED"] = "1"
# Modern HF cache only
env["HF_HOME"] = "/content/hf_home"
env.pop("TRANSFORMERS_CACHE", None)
env.pop("HF_HUB_CACHE", None)
Path(env["HF_HOME"]).mkdir(parents=True, exist_ok=True)
proc = subprocess.Popen(
["/content/bin/micromamba", "run", "-n", "cb311", "python", "-u", "server.py"],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
text=True,
bufsize=1,
env=env,
)
with open(LOG_STDOUT, "w", encoding="utf-8", errors="replace") as f:
shown_link = False
while True:
line = proc.stdout.readline()
if line:
print(line, end="")
f.write(line)
f.flush()
if (not shown_link) and port_open():
shown_link = True
print("\n=== Server port is reachable ===")
from google.colab.output import serve_kernel_port_as_window
serve_kernel_port_as_window(PORT)
# Verify model load status
try:
mi = requests.get(f"http://127.0.0.1:{PORT}/api/model-info", timeout=3).json()
print("\n/api/model-info:", mi)
except Exception as e:
print("\n/api/model-info query failed:", repr(e))
if proc.poll() is not None:
print("\n=== Server process exited with code", proc.returncode, "===")
break
Add this code in a new cell above the 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))"
Where exactly do I put it in cell 4 ? I tried it and it didn't work.
This issue is probably due to the perth library not being in requirements. I thought some kind of pip install resemble-perth would fix the issue, but I wasn't able to. My very crude workaround was patching the code to remove perth. If someone is smarter maybe they can add the requirement or make the import work. My solution is to replace the 4th cell with
# @title 4. Install Server + Run With Full Live Logs (Patched Stable Version) import os, subprocess, socket, requests, pathlib from pathlib import Path PORT = 8004 REPO_DIR = "/content/Chatterbox-TTS-Server" LOG_STDOUT = "/content/chatterbox_server_stdout.log" def sh(cmd, check=False): return subprocess.run(["bash", "-lc", cmd], check=check) def port_open(host="127.0.0.1", port=PORT, timeout=0.25): try: with socket.create_connection((host, port), timeout=timeout): return True except OSError: return False os.chdir("/content") # Fresh clone sh("rm -rf /content/Chatterbox-TTS-Server", check=False) sh("git clone https://github.com/devnen/Chatterbox-TTS-Server.git", check=True) os.chdir(REPO_DIR) print("=== Quick system checks ===") sh("nvidia-smi || true", check=False) print("\n=== Installing server requirements ===") if Path("requirements-nvidia.txt").exists(): sh("/content/bin/micromamba run -n cb311 pip install -U pip setuptools wheel", check=False) sh("/content/bin/micromamba run -n cb311 pip install -r requirements-nvidia.txt", check=False) else: sh( "/content/bin/micromamba run -n cb311 pip install -U pip setuptools wheel && " "/content/bin/micromamba run -n cb311 pip install " "fastapi 'uvicorn[standard]' pyyaml soundfile librosa safetensors " "python-multipart requests jinja2 watchdog aiofiles unidecode inflect tqdm " "pydub audiotsm praat-parselmouth peft", check=False ) # --------------------------------------------------- # 🔧 PATCH: Disable Perth watermarker (fix Colab crash) # --------------------------------------------------- print("\n=== Patching chatterbox turbo (disable Perth watermarker) ===") t3_file = pathlib.Path("/root/.local/share/mamba/envs/cb311/lib/python3.11/site-packages/chatterbox/tts_turbo.py") if t3_file.exists(): text = t3_file.read_text() if "PerthImplicitWatermarker" in text or "apply_watermark" in text: text = text.replace( "self.watermarker = perth.PerthImplicitWatermarker()", "self.watermarker = None # Patched: disable Perth watermarker for Colab" ) text = text.replace( "self.watermarker.apply_watermark(wav, sample_rate=self.sr)", "wav" ) t3_file.write_text(text) print("✓ Patched Perth watermarker in micromamba env") else: print("✓ Patch not needed") else: print("⚠ Could not locate tts_turbo.py in micromamba env") # --------------------------------------------------- print("\n=== Removing old stdout log ===") Path(LOG_STDOUT).unlink(missing_ok=True) print("\n=== Starting server with LIVE logs ===") print("Log file:", LOG_STDOUT) print("To stop the server, interrupt this cell.\n") env = os.environ.copy() env["PYTHONUNBUFFERED"] = "1" # Modern HF cache only env["HF_HOME"] = "/content/hf_home" env.pop("TRANSFORMERS_CACHE", None) env.pop("HF_HUB_CACHE", None) Path(env["HF_HOME"]).mkdir(parents=True, exist_ok=True) proc = subprocess.Popen( ["/content/bin/micromamba", "run", "-n", "cb311", "python", "-u", "server.py"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, bufsize=1, env=env, ) with open(LOG_STDOUT, "w", encoding="utf-8", errors="replace") as f: shown_link = False while True: line = proc.stdout.readline() if line: print(line, end="") f.write(line) f.flush() if (not shown_link) and port_open(): shown_link = True print("\n=== Server port is reachable ===") from google.colab.output import serve_kernel_port_as_window serve_kernel_port_as_window(PORT) # Verify model load status try: mi = requests.get(f"http://127.0.0.1:{PORT}/api/model-info", timeout=3).json() print("\n/api/model-info:", mi) except Exception as e: print("\n/api/model-info query failed:", repr(e)) if proc.poll() is not None: print("\n=== Server process exited with code", proc.returncode, "===") break
Works perfectly... Thanks
Where exactly do I put it in cell 4 ? I tried it and it didn't work.
Replace the complete code.
Where exactly do I put it in cell 4 ? I tried it and it didn't work.
Create new cell above 4th cell and past the code.
Add this code in a new cell above the 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))"
can you post screenshot of adding this cell...?
I tried both code changes and cannot get the model to load correctly.
This issue is probably due to the perth library not being in requirements. I thought some kind of pip install resemble-perth would fix the issue, but I wasn't able to. My very crude workaround was patching the code to remove perth. If someone is smarter maybe they can add the requirement or make the import work. My solution is to replace the 4th cell with
# @title 4. Install Server + Run With Full Live Logs (Patched Stable Version) import os, subprocess, socket, requests, pathlib from pathlib import Path PORT = 8004 REPO_DIR = "/content/Chatterbox-TTS-Server" LOG_STDOUT = "/content/chatterbox_server_stdout.log" def sh(cmd, check=False): return subprocess.run(["bash", "-lc", cmd], check=check) def port_open(host="127.0.0.1", port=PORT, timeout=0.25): try: with socket.create_connection((host, port), timeout=timeout): return True except OSError: return False os.chdir("/content") # Fresh clone sh("rm -rf /content/Chatterbox-TTS-Server", check=False) sh("git clone https://github.com/devnen/Chatterbox-TTS-Server.git", check=True) os.chdir(REPO_DIR) print("=== Quick system checks ===") sh("nvidia-smi || true", check=False) print("\n=== Installing server requirements ===") if Path("requirements-nvidia.txt").exists(): sh("/content/bin/micromamba run -n cb311 pip install -U pip setuptools wheel", check=False) sh("/content/bin/micromamba run -n cb311 pip install -r requirements-nvidia.txt", check=False) else: sh( "/content/bin/micromamba run -n cb311 pip install -U pip setuptools wheel && " "/content/bin/micromamba run -n cb311 pip install " "fastapi 'uvicorn[standard]' pyyaml soundfile librosa safetensors " "python-multipart requests jinja2 watchdog aiofiles unidecode inflect tqdm " "pydub audiotsm praat-parselmouth peft", check=False ) # --------------------------------------------------- # 🔧 PATCH: Disable Perth watermarker (fix Colab crash) # --------------------------------------------------- print("\n=== Patching chatterbox turbo (disable Perth watermarker) ===") t3_file = pathlib.Path("/root/.local/share/mamba/envs/cb311/lib/python3.11/site-packages/chatterbox/tts_turbo.py") if t3_file.exists(): text = t3_file.read_text() if "PerthImplicitWatermarker" in text or "apply_watermark" in text: text = text.replace( "self.watermarker = perth.PerthImplicitWatermarker()", "self.watermarker = None # Patched: disable Perth watermarker for Colab" ) text = text.replace( "self.watermarker.apply_watermark(wav, sample_rate=self.sr)", "wav" ) t3_file.write_text(text) print("✓ Patched Perth watermarker in micromamba env") else: print("✓ Patch not needed") else: print("⚠ Could not locate tts_turbo.py in micromamba env") # --------------------------------------------------- print("\n=== Removing old stdout log ===") Path(LOG_STDOUT).unlink(missing_ok=True) print("\n=== Starting server with LIVE logs ===") print("Log file:", LOG_STDOUT) print("To stop the server, interrupt this cell.\n") env = os.environ.copy() env["PYTHONUNBUFFERED"] = "1" # Modern HF cache only env["HF_HOME"] = "/content/hf_home" env.pop("TRANSFORMERS_CACHE", None) env.pop("HF_HUB_CACHE", None) Path(env["HF_HOME"]).mkdir(parents=True, exist_ok=True) proc = subprocess.Popen( ["/content/bin/micromamba", "run", "-n", "cb311", "python", "-u", "server.py"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, bufsize=1, env=env, ) with open(LOG_STDOUT, "w", encoding="utf-8", errors="replace") as f: shown_link = False while True: line = proc.stdout.readline() if line: print(line, end="") f.write(line) f.flush() if (not shown_link) and port_open(): shown_link = True print("\n=== Server port is reachable ===") from google.colab.output import serve_kernel_port_as_window serve_kernel_port_as_window(PORT) # Verify model load status try: mi = requests.get(f"http://127.0.0.1:{PORT}/api/model-info", timeout=3).json() print("\n/api/model-info:", mi) except Exception as e: print("\n/api/model-info query failed:", repr(e)) if proc.poll() is not None: print("\n=== Server process exited with code", proc.returncode, "===") breakWorks perfectly... Thanks
I tried replacing it and get the same error, i must be doing something wrong.
Closing, the Colab notebook has been updated multiple times since this report (perth watermarker patch in cell 4, protobuf force-upgrade, kernel proxy URL fix, chatterbox install via --no-deps). Please pull the latest Chatterbox_TTS_Colab_Demo.ipynb and run cells 1 to 4 fresh. Reopen with the cell output if 'Model not loaded' still appears.