Wiki source code of Install OpenVoice v2 Locally - Instantly Clone Voice with AI
Version 2.6 by René Schmidt on 2025/03/10 19:43
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | conda create -n openvoice python=3.9 | ||
| 2 | conda activate openvoice | ||
| 3 | |||
| 4 | |||
| 5 | git clone [[https:~~/~~/github.com/myshell-ai/openVoice.git>>https://github.com/myshell-ai/openVoice.git]] | ||
| 6 | |||
| 7 | cd openVoice | ||
| 8 | pip install -e . | ||
| 9 | mkdir checkpoints_v2 | ||
| 10 | cd checkpoints_v2 | ||
| 11 | wget [[https:~~/~~/myshell-public-repo-host.s3.amazonaws.com/openvoice/checkpoints_v2_0417.zip>>https://myshell-public-repo-host.s3.amazonaws.com/openvoice/checkpoints_v2_0417.zip]] | ||
| 12 | |||
| 13 | unzip checkpoints_v2_0417.zip | ||
| 14 | |||
| 15 | |||
| 16 | mv checkpoints_v2 ~~/OpenVoice | ||
| 17 | |||
| 18 | |||
| 19 | |||
| 20 | |||
| 21 | |||
| 22 | |||
| 23 | pip install git+https:~/~/github.com/cocktailpeanut/ov2.git | ||
| 24 | |||
| 25 | |||
| 26 | |||
| 27 | cd .. | ||
| 28 | pip install git+https:~/~/github.com/myshell-ai/MeloTTS.git | ||
| 29 | python -m unidic download | ||
| 30 | cd resources | ||
| 31 | python3 | ||
| 32 | |||
| 33 | |||
| 34 | |||
| 35 | import os | ||
| 36 | |||
| 37 | import torch | ||
| 38 | |||
| 39 | from openvoice import se_extractor | ||
| 40 | |||
| 41 | from openvoice.api import ToneColorConverter | ||
| 42 | |||
| 43 | ckpt_converter = 'checkpoints_v2/converter' | ||
| 44 | |||
| 45 | device = "cuda:0" if torch.cuda.is_available() else "cpu" | ||
| 46 | |||
| 47 | output_dir = 'outputs_v2' | ||
| 48 | |||
| 49 | tone_color_converter = ToneColorConverter(f' {ckpt_converter} /config.json', device=device) | ||
| 50 | |||
| 51 | tone_color_converter.load_ckpt(f' {ckpt_converter} /checkpoint.pth') | ||
| 52 | |||
| 53 | os.makedirs (output_dir, exist_ok=True) | ||
| 54 | |||
| 55 | reference_speaker = 'resources/example_reference.mp3' | ||
| 56 | |||
| 57 | target_se, audio_name = se_extractor.get_se(reference_speaker, tone_color_converter, vad=False) | ||
| 58 | |||
| 59 | from melo.api import TTS | ||
| 60 | |||
| 61 | src_path = f' {output_dir} /tmp.wav' | ||
| 62 | |||
| 63 | speed = 1.0 | ||
| 64 | |||
| 65 | |||
| 66 | |||
| 67 | |||
| 68 |