Update README.md
Browse files
README.md
CHANGED
@@ -27,7 +27,7 @@ It achieves the following results on the evaluation set:
|
|
27 |
Swedish SpeechT5 model trained on Swedish language in Common Voice. Example on how to implement the model below (not possible to run inference at Huggingface).
|
28 |
|
29 |
```
|
30 |
-
pip install datasets soundfile
|
31 |
pip install git+https://github.com/huggingface/transformers.git
|
32 |
|
33 |
from transformers import SpeechT5Processor, SpeechT5ForTextToSpeech, SpeechT5HifiGan, set_seed
|
@@ -53,6 +53,7 @@ repl = [
|
|
53 |
|
54 |
]
|
55 |
|
|
|
56 |
embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
|
57 |
|
58 |
speaker_embeddings = torch.tensor(embeddings_dataset[7000]["xvector"]).unsqueeze(0)
|
@@ -65,8 +66,8 @@ inputs = processor(text=text, return_tensors="pt")
|
|
65 |
|
66 |
speech = model.generate_speech(inputs["input_ids"], speaker_embeddings, vocoder=vocoder)
|
67 |
|
68 |
-
|
69 |
-
|
70 |
|
71 |
```
|
72 |
|
|
|
27 |
Swedish SpeechT5 model trained on Swedish language in Common Voice. Example on how to implement the model below (not possible to run inference at Huggingface).
|
28 |
|
29 |
```
|
30 |
+
pip install datasets soundfile
|
31 |
pip install git+https://github.com/huggingface/transformers.git
|
32 |
|
33 |
from transformers import SpeechT5Processor, SpeechT5ForTextToSpeech, SpeechT5HifiGan, set_seed
|
|
|
53 |
|
54 |
]
|
55 |
|
56 |
+
from datasets import load_dataset
|
57 |
embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
|
58 |
|
59 |
speaker_embeddings = torch.tensor(embeddings_dataset[7000]["xvector"]).unsqueeze(0)
|
|
|
66 |
|
67 |
speech = model.generate_speech(inputs["input_ids"], speaker_embeddings, vocoder=vocoder)
|
68 |
|
69 |
+
import soundfile as sf
|
70 |
+
sf.write("output.wav", speech.numpy(), samplerate=16000)
|
71 |
|
72 |
```
|
73 |
|