common_voice generated_from_trainer

<!-- 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 on the Common Voice dataset. It achieves the following results on the evaluation set:

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 (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:

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