Splintir commited on
Commit
3fb08eb
·
verified ·
1 Parent(s): 790f998

Play the clip inline in a notebook, and say what Colab needs

Browse files
Files changed (1) hide show
  1. README.md +12 -2
README.md CHANGED
@@ -145,10 +145,20 @@ with torch.inference_mode():
145
  speech = model.generate_speech(ids, speaker, vocoder=vocoder)
146
 
147
  sf.write("out.wav", speech.numpy(), 16000) # 16 kHz mono
 
 
 
 
148
  ```
149
 
150
- Runs on CPU. For GPU, `.to("cuda")` the model, the vocoder and `ids`/`speaker`,
151
- then `.cpu()` the result before `sf.write`.
 
 
 
 
 
 
152
 
153
  Spell numbers out: the tokenizer is character-level Latin and drops digits
154
  silently.
 
145
  speech = model.generate_speech(ids, speaker, vocoder=vocoder)
146
 
147
  sf.write("out.wav", speech.numpy(), 16000) # 16 kHz mono
148
+
149
+ # In a notebook (Colab, Jupyter), play it inline instead of saving:
150
+ from IPython.display import Audio, display
151
+ display(Audio(speech.numpy(), rate=16000))
152
  ```
153
 
154
+ Runs unmodified on a stock Colab CPU runtime every dependency is preinstalled,
155
+ including the `sentencepiece` the tokenizer needs — at roughly 1.8× real time.
156
+ For GPU, `.to("cuda")` the model, the vocoder and `ids`/`speaker`, then `.cpu()`
157
+ the result before `sf.write`.
158
+
159
+ The `display(Audio(...))` line renders a play button in a notebook cell. It
160
+ produces no sound over a terminal or SSH session; there, write the wav and fetch
161
+ it (`from google.colab import files; files.download("out.wav")`).
162
 
163
  Spell numbers out: the tokenizer is character-level Latin and drops digits
164
  silently.