bark voice cloning HuBERT quantizer
1.0.0
该代码可在Python 3.10上使用,我尚未在其他版本上对其进行测试。一些较旧的版本会遇到问题。
现在有可能。
对于开发人员:
为每个人:
确保这些事情不在您的声音输入中:(没有特定顺序)
是什么使及时的音频变得好? (没有特定顺序)
| 姓名 | 休伯特模特 | Quantizer版本 | 时代 | 语言 | 数据集 |
|---|---|---|---|---|---|
| ventifier_hubert_base_ls960.pth | 休伯特基地 | 0 | 3 | 工程 | gitmylo/bark-semantic训练 |
| ventifier_hubert_base_ls960_14.pth | 休伯特基地 | 0 | 14 | 工程 | gitmylo/bark-semantic训练 |
| Quantifier_v1_hubert_base_ls960_23.pth | 休伯特基地 | 1 | 23 | 工程 | gitmylo/bark-semantic训练 |
| 作者 | 姓名 | 休伯特模特 | Quantizer版本 | 时代 | 语言 | 数据集 |
|---|---|---|---|---|---|---|
| Hobispl | 波兰 - 赫伯特 - Quantizer_8_epoch.pth | 休伯特基地 | 1 | 8 | pol | Hobis/Bark-Polish-semantic-Wav-Training |
| c0untfloyd | 德国 - 赫伯特 - Quantizer_14_epoch.pth | 休伯特基地 | 1 | 14 | Ger | Countfloyd/bark-german-emantic-wav-training |
from hubert . pre_kmeans_hubert import CustomHubert
import torchaudio
# Load the HuBERT model,
# checkpoint_path should work fine with data/models/hubert/hubert.pt for the default config
hubert_model = CustomHubert ( checkpoint_path = 'path/to/checkpoint' )
# Run the model to extract semantic features from an audio file, where wav is your audio file
wav , sr = torchaudio . load ( 'path/to/wav' ) # This is where you load your wav, with soundfile or torchaudio for example
if wav . shape [ 0 ] == 2 : # Stereo to mono if needed
wav = wav . mean ( 0 , keepdim = True )
semantic_vectors = hubert_model . forward ( wav , input_sample_hz = sr ) import torch
from hubert . customtokenizer import CustomTokenizer
# Load the CustomTokenizer model from a checkpoint
# With default config, you can use the pretrained model from huggingface
# With the default setup from HuBERTManager, this will be in data/models/hubert/tokenizer.pth
tokenizer = CustomTokenizer . load_from_checkpoint ( 'data/models/hubert/tokenizer.pth' ) # Automatically uses the right layers
# Process the semantic vectors from the previous HuBERT run (This works in batches, so you can send the entire HuBERT output)
semantic_tokens = tokenizer . get_token ( semantic_vectors )
# Congratulations! You now have semantic tokens which can be used inside of a speaker prompt file. 只需运行训练命令即可。
创建语义数据和WAV进行训练的一种简单方法是我的脚本:Bark-data-Gen。但是请记住,即使不超过语义的创建,波浪的创建将大约相同的时间。因此,这可能需要一段时间才能生成。
例如,如果您有一个包含音频文件的zips的数据集,一个用于语义的zip和一个用于WAV文件的zip。在一个名为“文学”的文件夹中
您应该运行process.py --path Literature --mode prepare将所有数据提取到一个目录
您应该运行process.py --path Literature --mode prepare2用于创建Hubert语义向量,准备培训
您应该运行process.py --path Literature --mode train
而且,如果您的模型进行了足够的培训,则可以运行process.py --path Literature --mode test以测试最新模型。
我对使用该模型创建的语义生成的音频不承担任何责任。只是不要将其用于非法目的。