File size: 3,175 Bytes
f546388 4c787b3 f546388 4e0b73f 68753bb f546388 72bd952 ab19903 68753bb 2a06e40 ab19903 cd4a92d ab19903 468c094 ab19903 468c094 ab19903 f546388 c871595 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
---
language:
- sv
license: mit
tags:
- common_voice
- generated_from_trainer
datasets:
- mozilla-foundation/common_voice_13_0
model-index:
- name: SpeechT5 TTS Swedish
results: []
pipeline_tag: text-to-speech
inference: false
---
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
should probably proofread and complete it, then remove this comment. -->
# SpeechT5 TTS Swedish
This model is a fine-tuned version of [microsoft/speecht5_tts](https://huggingface.co/microsoft/speecht5_tts) on the Common Voice dataset.
It achieves the following results on the evaluation set:
- Loss: 0.4621
## Model description
Swedish SpeechT5 model trained on Swedish language in Common Voice. Example on how to implement the model below. Test the model yourself at [https://huggingface.co/spaces/GreenCounsel/SpeechT5-sv](https://huggingface.co/spaces/GreenCounsel/SpeechT5-sv) (not possible to run pipeline inference at Huggingface).
```
#pip install datasets soundfile
#pip install transformers
#pip install sentencepiece
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)
```
## Intended uses & limitations
More information needed
## Training and evaluation data
More information needed
## Training procedure
### Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 1e-05
- train_batch_size: 16
- eval_batch_size: 8
- seed: 42
- gradient_accumulation_steps: 2
- total_train_batch_size: 32
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- lr_scheduler_warmup_steps: 500
- training_steps: 4000
- mixed_precision_training: Native AMP
### Training results
| Training Loss | Epoch | Step | Validation Loss |
|:-------------:|:-----:|:----:|:---------------:|
| 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 |
### Framework versions
- Transformers 4.30.0.dev0
- Pytorch 2.0.1+cu118
- Datasets 2.13.1
- Tokenizers 0.13.3 |