เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

การ Fine-tune โมเดล Text-to-Speech

ในแบบฝึกหัดนี้จะใช้ VCTK Corpus ซึ่งเป็นชุดข้อมูลเสียงพูดความยาวประมาณ 44 ชั่วโมงจากผู้พูดภาษาอังกฤษหลากหลายสำเนียง เพื่อ fine-tune โมเดล text-to-speech ให้จำลองสำเนียงท้องถิ่นได้

dataset ถูกโหลดและประมวลผลล่วงหน้าแล้ว รวมถึงโมดูล SpeechT5ForTextToSpeech, Seq2SeqTrainingArguments และ Seq2SeqTrainer ก็ถูกโหลดไว้แล้วเช่นกัน นอกจากนี้ยังมี data collator (data_collator) ที่กำหนดค่าไว้ล่วงหน้าให้แล้ว

กรุณาอย่าเรียกเมธอด .train() บน trainer config เนื่องจากโค้ดจะหมดเวลาในสภาพแวดล้อมนี้

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

โมเดล Multi-Modal ด้วย Hugging Face

ดูคอร์ส

คำแนะนำการฝึกหัด

  • โหลดโมเดล pretrained microsoft/speecht5_tts โดยใช้ SpeechT5ForTextToSpeech
  • สร้าง instance ของ Seq2SeqTrainingArguments โดยกำหนด: gradient_accumulation_steps เป็น 8, learning_rate เป็น 0.00001, warmup_steps เป็น 500 และ max_steps เป็น 4000
  • กำหนดค่า trainer ด้วย training arguments ที่สร้างขึ้น พร้อมกับ model, ข้อมูล และ processor ที่เตรียมไว้ให้

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

# Load the text-to-speech pretrained model
model = ____.____(____)

# Configure the required training arguments
training_args = ____(output_dir="speecht5_finetuned_vctk_test",
    gradient_accumulation_steps=____, learning_rate=____, warmup_steps=____, max_steps=4000, label_names=["labels"],
    push_to_hub=False)

# Configure the trainer
trainer = ____(args=training_args, model=model, data_collator=data_collator,
    train_dataset=dataset["train"], eval_dataset=dataset["test"], tokenizer=processor)
แก้ไขและรันโค้ด