Automatic Speech Recognition
Transformers
Safetensors
prosody_to_text
feature-extraction
prosody
speech-recognition
custom_code
Instructions to use Daporte/prosody2text-weights with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Daporte/prosody2text-weights with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("automatic-speech-recognition", model="Daporte/prosody2text-weights", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Daporte/prosody2text-weights", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download _yaapt_patch.py from Daporte/prosody2text-weights: direct link, hf CLI and curl.
- Browser
- Download file 2.07 kB
-
https://huggingface.co/Daporte/prosody2text-weights/resolve/main/_yaapt_patch.py
- Command line
-
hf download hf://Daporte/prosody2text-weights/_yaapt_patch.py
-
curl -L -o _yaapt_patch.py https://huggingface.co/Daporte/prosody2text-weights/resolve/main/_yaapt_patch.py
2.07 kB
| """pYAAPT's f0 interpolation, with the fix the training pipeline applies. | |
| Copied verbatim from `precompute_prosody._patched_interpolate` in the | |
| prosody_embeddings_to_mel repo. Stock pYAAPT mishandles extrapolation before | |
| the first and after the last voiced frame, which can flatten the entire | |
| contour; the preprocessor the training pipeline replaced monkey-patches this | |
| in, so f0_interp only matches the offline pipeline with the same patch. | |
| Kept as a verbatim copy rather than an import because that repo's module | |
| pulls in a submodule that is not checked out. If the original changes, this | |
| must be re-copied. | |
| """ | |
| from __future__ import annotations | |
| def patched_interpolate(self): | |
| """pYAAPT.PitchObj.interpolate with the MU-NLPC fix, copied verbatim. | |
| Stock pYAAPT mishandles extrapolation before the first and after the last | |
| voiced frame, which can flatten the entire f0 contour. The preprocessor we | |
| are replacing monkey-patches this in, so f0_interp only matches the offline | |
| pipeline's if the same patch is applied here. | |
| """ | |
| import numpy as _np | |
| from scipy import interpolate as scipy_interp | |
| from scipy.signal import medfilt | |
| pitch = _np.zeros((self.nframes)) | |
| pitch[:] = self.samp_values | |
| pitch2 = medfilt(self.samp_values, self.SMOOTH_FACTOR) | |
| edges = self.edges_finder(pitch) | |
| first_sample = pitch[0] | |
| last_sample = pitch[-1] | |
| if len(_np.nonzero(pitch2)[0]) < 2: | |
| pitch[pitch == 0] = self.PTCH_TYP | |
| else: | |
| nz_pitch = pitch2[pitch2 > 0] | |
| pitch2 = scipy_interp.pchip(_np.nonzero(pitch2)[0], | |
| nz_pitch)(range(self.nframes)) | |
| pitch[pitch == 0] = pitch2[pitch == 0] | |
| if self.SMOOTH > 0: | |
| pitch = medfilt(pitch, self.SMOOTH_FACTOR) | |
| try: | |
| if first_sample == 0: | |
| if edges[0] == 0: | |
| edges[0] = 1 | |
| pitch[:edges[0] - 1] = pitch[edges[0]] | |
| if last_sample == 0: | |
| pitch[edges[-1] + 1:] = pitch[edges[-1]] | |
| except Exception: | |
| pass | |
| self.samp_interp = pitch | |