Files
Piotr Kawa aa003f2d66 Feature: Update example scripts, add example wavs, add info on watermarking, safetensor in VC model (#82)
* update examples, add info on watermarking

* fix: safetensor in VC model

* fix: remove example files
2025-06-04 21:54:02 +08:00

25 lines
531 B
Python

import torch
import torchaudio as ta
from chatterbox.vc import ChatterboxVC
# 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}")
AUDIO_PATH = "YOUR_FILE.wav"
TARGET_VOICE_PATH = "YOUR_FILE.wav"
model = ChatterboxVC.from_pretrained(device)
wav = model.generate(
audio=AUDIO_PATH,
target_voice_path=TARGET_VOICE_PATH,
)
ta.save("testvc.wav", wav, model.sr)