mirror of
https://github.com/resemble-ai/chatterbox.git
synced 2025-12-22 05:37:10 +00:00
* update examples, add info on watermarking * fix: safetensor in VC model * fix: remove example files
25 lines
531 B
Python
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)
|