Procházet zdrojové kódy

Merge pull request #24 from facebookresearch/cndn-patch-1

Add instruction to resample in predict README
Ning před 2 roky
rodič
revize
0cdd3388f8
1 změnil soubory, kde provedl 9 přidání a 0 odebrání
  1. 9 0
      scripts/m4t/predict/README.md

+ 9 - 0
scripts/m4t/predict/README.md

@@ -39,6 +39,15 @@ python scripts/m4t/predict/predict.py <input_text> t2st <tgt_lang> --src_lang <s
 python scripts/m4t/predict/predict.py <path_to_input_audio> asr <tgt_lang>
 ```
 
+Note that it takes 16kHz audio now. Here's how you could resample your audio:
+```python
+import torchaudio
+resample_rate = 16000
+waveform, sample_rate = torchaudio.load(<path_to_input_audio>)
+resampler = torchaudio.transforms.Resample(sample_rate, resample_rate, dtype=waveform.dtype)
+resampled_waveform = resampler(waveform)
+torchaudio.save(<path_to_resampled_audio>, resampled_waveform, resample_rate)
+```
 ## Inference breakdown
 
 Inference calls for the `Translator` object instantiated with a multitask UnitY model with the options: