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以測試最新模型。
我對使用該模型創建的語義生成的音頻不承擔任何責任。只是不要將其用於非法目的。