🚀 瑞典語語音T5文本轉語音模型
該模型是基於Common Voice數據集對 microsoft/speecht5_tts 進行微調後的版本。它在評估集上取得了以下結果:
✨ 主要特性
本模型是在Common Voice數據集中的瑞典語數據上訓練得到的瑞典語SpeechT5模型。可在 https://huggingface.co/spaces/GreenCounsel/SpeechT5-sv 自行測試該模型(無法在Huggingface上運行管道推理)。
📦 安裝指南
💻 使用示例
基礎用法
from transformers import SpeechT5Processor, SpeechT5ForTextToSpeech, SpeechT5HifiGan, set_seed
import torch
processor = SpeechT5Processor.from_pretrained("microsoft/speecht5_tts")
model = SpeechT5ForTextToSpeech.from_pretrained("GreenCounsel/speecht5_tts_common_voice_5_sv")
vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan")
repl = [
('Ä', 'ae'),
('Å', 'o'),
('Ö', 'oe'),
('ä', 'ae'),
('å', 'o'),
('ö', 'oe'),
('ô','oe'),
('-',''),
('‘',''),
('’',''),
('“',''),
('”',''),
]
from datasets import load_dataset
embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
speaker_embeddings = torch.tensor(embeddings_dataset[7000]["xvector"]).unsqueeze(0)
set_seed(555)
text="Förstår du vad han menar?"
for src, dst in repl:
text = text.replace(src, dst)
inputs = processor(text=text, return_tensors="pt")
speech = model.generate_speech(inputs["input_ids"], speaker_embeddings, vocoder=vocoder)
import soundfile as sf
sf.write("output.wav", speech.numpy(), samplerate=16000)
📚 詳細文檔
訓練和評估數據
更多信息待補充。
預期用途與限制
更多信息待補充。
🔧 技術細節
訓練超參數
訓練過程中使用了以下超參數:
- 學習率:1e-05
- 訓練批次大小:16
- 評估批次大小:8
- 隨機種子:42
- 梯度累積步數:2
- 總訓練批次大小:32
- 優化器:Adam(β1=0.9,β2=0.999,ε=1e-08)
- 學習率調度器類型:線性
- 學習率調度器熱身步數:500
- 訓練步數:4000
- 混合精度訓練:原生自動混合精度(Native AMP)
訓練結果
訓練損失 |
輪數 |
步數 |
驗證損失 |
0.5349 |
4.8 |
1000 |
0.4953 |
0.5053 |
9.59 |
2000 |
0.4714 |
0.5032 |
14.39 |
3000 |
0.4646 |
0.4958 |
19.18 |
4000 |
0.4621 |
框架版本
- Transformers 4.30.0.dev0
- Pytorch 2.0.1+cu118
- Datasets 2.13.1
- Tokenizers 0.13.3
📄 許可證
本項目採用MIT許可證。