รหัสนี้ใช้งานได้กับ Python 3.10 ฉันยังไม่ได้ทดสอบในเวอร์ชันอื่น รุ่นเก่าบางรุ่นจะมีปัญหา
เป็นไปได้ในตอนนี้
สำหรับนักพัฒนา:
สำหรับทุกคน:
ตรวจสอบให้แน่ใจว่าสิ่งเหล่านี้ ไม่ได้ อยู่ในการป้อนข้อมูลเสียงของคุณ: (ไม่มีลำดับโดยเฉพาะ)
อะไรทำให้เสียงที่ดีพร้อมกัน? (ไม่มีคำสั่งเฉพาะ)
| ชื่อ | โมเดลฮิวเบิร์ต | รุ่น Quantizer | ยุค | ภาษา | ชุดข้อมูล |
|---|---|---|---|---|---|
| quantifier_hubert_base_ls960.pth | ฐานฮิวเบิร์ต | 0 | 3 | ของอังกฤษ | Gitmylo/Bark-Semantic-Training |
| quantifier_hubert_base_ls960_14.pth | ฐานฮิวเบิร์ต | 0 | 14 | ของอังกฤษ | Gitmylo/Bark-Semantic-Training |
| quantifier_v1_hubert_base_ls960_23.pth | ฐานฮิวเบิร์ต | 1 | 23 | ของอังกฤษ | Gitmylo/Bark-Semantic-Training |
| ผู้เขียน | ชื่อ | โมเดลฮิวเบิร์ต | รุ่น Quantizer | ยุค | ภาษา | ชุดข้อมูล |
|---|---|---|---|---|---|---|
| HOBISPL | Polish-Hubert-Quantizer_8_epoch.pth | ฐานฮิวเบิร์ต | 1 | 8 | โพล | Hobis/Bark-polish-semantic-wav-training |
| c0untfloyd | German-Hubert-Quantizer_14_epoch.pth | ฐานฮิวเบิร์ต | 1 | 14 | คนดี | Countfloyd/Bark-German-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. เพียงเรียกใช้คำสั่งการฝึกอบรม
วิธีง่ายๆในการสร้างข้อมูลความหมายและ WAVs สำหรับการฝึกอบรมคือสคริปต์ของฉัน: BARK-DATA-GEN แต่โปรดจำไว้ว่าการสร้าง WAVS จะใช้เวลาในเวลาเดียวกันหากไม่นานกว่าการสร้างความหมาย สิ่งนี้อาจใช้เวลาสักครู่ในการสร้างเพราะสิ่งนั้น
ตัวอย่างเช่นหากคุณมีชุดข้อมูลที่มีซิปที่มีไฟล์เสียงหนึ่งซิปสำหรับความหมายและอีกไฟล์สำหรับไฟล์ WAV ภายในโฟลเดอร์ที่เรียกว่า "วรรณกรรม"
คุณควรเรียกใช้ process.py --path Literature --mode prepare สำหรับการแยกข้อมูลทั้งหมดไปยังไดเรกทอรีหนึ่งไดเรกทอรี
คุณควรเรียกใช้ process.py --path Literature --mode prepare2 สำหรับการสร้าง Hubert Semantic Vectors พร้อมสำหรับการฝึกอบรม
คุณควรเรียกใช้ process.py --path Literature --mode train สำหรับการฝึกอบรม
และเมื่อโมเดลของคุณได้รับการฝึกฝนเพียงพอคุณสามารถเรียกใช้ process.py --path Literature --mode test เพื่อทดสอบโมเดลล่าสุด
ฉันไม่รับผิดชอบต่อเสียงที่สร้างขึ้นโดยใช้ความหมายที่สร้างขึ้นโดยรุ่นนี้ อย่าใช้มันเพื่อจุดประสงค์ที่ผิดกฎหมาย