chaanks commited on
Commit
61858f2
1 Parent(s): 4e37874

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +22 -2
README.md CHANGED
@@ -34,17 +34,37 @@ Please notice that we encourage you to read our tutorials and learn more about
34
  [SpeechBrain](https://speechbrain.github.io).
35
 
36
 
37
- ### Transcribing your own audio files
38
 
39
  ```python
40
  from speechbrain.pretrained import UnitHIFIGAN
41
 
42
- hifi_gan_unit = UnitHIFIGAN.from_hparams(source="speechbrain/hifigan-unit-hubert-l6-k100-ljspeech")
43
  codes = torch.randint(0, 99, (100,))
44
  waveform = hifi_gan.decode_unit(codes)
45
 
46
  ```
47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  ### Inference on GPU
49
  To perform inference on the GPU, add `run_opts={"device":"cuda"}` when calling the `from_hparams` method.
50
 
 
34
  [SpeechBrain](https://speechbrain.github.io).
35
 
36
 
37
+ ### Using the Vocoder
38
 
39
  ```python
40
  from speechbrain.pretrained import UnitHIFIGAN
41
 
42
+ hifi_gan_unit = UnitHIFIGAN.from_hparams(source="speechbrain/tts-hifigan-unit-hubert-l6-k100-ljspeech", savedir=tmpdir_vocoder)
43
  codes = torch.randint(0, 99, (100,))
44
  waveform = hifi_gan.decode_unit(codes)
45
 
46
  ```
47
 
48
+ ### Using the Vocoder with the S2UT
49
+ ```python
50
+ import torchaudio
51
+ from speechbrain.pretrained import EncoderDecoderS2UT
52
+ from speechbrain.pretrained import UnitHIFIGAN
53
+
54
+ # Intialize S2UT (Transformer) and Vocoder (HiFIGAN Unit)
55
+ s2ut = EncoderDecoderS2UT.from_hparams(source="speechbrain/s2st-transformer-fr-en-hubert-l6-k100-cvss", savedir=tmpdir_s2ut)
56
+ hifi_gan_unit = UnitHIFIGAN.from_hparams(source="speechbrain/tts-hifigan-unit-hubert-l6-k100-ljspeech", savedir=tmpdir_vocoder)
57
+
58
+ # Running the S2UT model
59
+ codes = s2ut.translate_file("speechbrain/s2st-transformer-fr-en-hubert-l6-k100-cvss/example-fr.wav")
60
+
61
+ # Running Vocoder (units-to-waveform)
62
+ waveforms = hifi_gan.decode_unit(codes)
63
+
64
+ # Save the waverform
65
+ torchaudio.save('example_TTS.wav',waveforms.squeeze(1), 16000)
66
+ ```
67
+
68
  ### Inference on GPU
69
  To perform inference on the GPU, add `run_opts={"device":"cuda"}` when calling the `from_hparams` method.
70