Kode ini berfungsi pada Python 3.10, saya belum mengujinya pada versi lain. Beberapa versi yang lebih tua akan memiliki masalah.
Itu mungkin sekarang.
Untuk pengembang:
Untuk semua orang:
Pastikan hal -hal ini tidak ada dalam input suara Anda: (tanpa urutan tertentu)
Apa yang membuat audio cepat yang bagus? (tanpa urutan tertentu)
| Nama | Model Hubert | Versi Quantizer | Masa | Bahasa | Dataset |
|---|---|---|---|---|---|
| quantifier_hubert_base_ls960.pth | Pangkalan Hubert | 0 | 3 | Eng | Gitmylo/Bark-Semantic-Training |
| quantifier_hubert_base_ls960_14.pth | Pangkalan Hubert | 0 | 14 | Eng | Gitmylo/Bark-Semantic-Training |
| quantifier_v1_hubert_base_ls960_23.pth | Pangkalan Hubert | 1 | 23 | Eng | Gitmylo/Bark-Semantic-Training |
| Pengarang | Nama | Model Hubert | Versi Quantizer | Masa | Bahasa | Dataset |
|---|---|---|---|---|---|---|
| Hobispl | Polandia-hubert-quantizer_8_epoch.pth | Pangkalan Hubert | 1 | 8 | Pol | Hobi/bark-polos-semantik-wav-pelatihan |
| C0untfloyd | Jerman-hubert-quantizer_14_epoch.pth | Pangkalan Hubert | 1 | 14 | Ger | Countfloyd/Bark-Jerman-Semantic-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. Cukup jalankan perintah pelatihan.
Cara sederhana untuk membuat data semantik dan WAV untuk pelatihan, adalah dengan skrip saya: bark-data-gen. Tetapi ingat bahwa penciptaan WAV akan mengambil waktu yang sama jika tidak lagi dari penciptaan semantik. Ini bisa memakan waktu untuk menghasilkan karena itu.
Misalnya, jika Anda memiliki dataset dengan ritsleting yang berisi file audio, satu zip untuk semantik, dan satu untuk file WAV. Di dalam folder yang disebut "Sastra"
Anda harus menjalankan process.py --path Literature --mode prepare untuk mengekstraksi semua data ke satu direktori
Anda harus menjalankan process.py --path Literature --mode prepare2 untuk membuat vektor semantik hubert, siap untuk pelatihan
Anda harus menjalankan process.py --path Literature --mode train Untuk Pelatihan
Dan ketika model Anda telah cukup terlatih, Anda dapat menjalankan process.py --path Literature --mode test untuk menguji model terbaru.
Saya tidak bertanggung jawab atas audio yang dihasilkan menggunakan semantik yang dibuat oleh model ini. Hanya saja, jangan gunakan itu untuk tujuan ilegal.