Text-to-Speech
MLX
PyTorch
Portuguese
tts
pt-br
brazilian-portuguese
tinyml
esp32
esp32-s3
microcontroller
embedded
quantized
int8
4-bit precision
fargan
pingo
webassembly
javascript
Instructions to use semfence/pingo-ptbr-edge with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use semfence/pingo-ptbr-edge with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download semfence/pingo-ptbr-edge --local-dir pingo-ptbr-edge
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
Download python/check.py from semfence/pingo-ptbr-edge: direct link, hf CLI and curl.
- Browser
- Download file 1.47 kB
-
https://huggingface.co/semfence/pingo-ptbr-edge/resolve/main/python/check.py
- Command line
-
hf download hf://semfence/pingo-ptbr-edge/python/check.py
-
curl -L -o check.py https://huggingface.co/semfence/pingo-ptbr-edge/resolve/main/python/check.py
1.47 kB
| """Checks the backends against the C code: python check.py (needs torch and mlx) | |
| Measures the relative rms error of the acoustic model against the C/MLX reference (c/ac_test_ref.f32) and of the MLX vocoder against PyTorch.""" | |
| import pathlib, sys | |
| import numpy as np | |
| HERE = pathlib.Path(__file__).resolve().parent; sys.path.insert(0, str(HERE)) | |
| from pingo_edge.acoustic_torch import AcousticTorch | |
| from pingo_edge.acoustic_mlx_edge import AcousticMLX | |
| from pingo_edge.vocoder_torch import Vocoder as VT | |
| from pingo_edge.vocoder_mlx import Vocoder as VM | |
| a = np.fromfile(HERE.parent / "c" / "ac_test_in.i32", np.int32); L, voice = int(a[0]), int(a[1]) | |
| ids, st, mask = a[2:2 + L], a[2 + L:2 + 2 * L], a[2 + 2 * L:2 + 3 * L].astype(bool) | |
| ref = np.fromfile(HERE.parent / "c" / "ac_test_ref.f32", np.float32); T = int(ref[0]); rf = ref[1 + L:].reshape(T, 20) | |
| rel = lambda x, y: float(np.sqrt(((x - y) ** 2).mean() / (y ** 2).mean())) | |
| ft, _ = AcousticTorch().features(ids.tolist(), st.tolist(), voice, 1.0, mask) | |
| fm, _ = AcousticMLX().features(ids.tolist(), st.tolist(), voice, 1.0, mask) | |
| print(f"quadros: torch {len(ft)} | mlx {len(fm)} | referência {T}") | |
| print(f"acústico, erro rms relativo contra a referência: torch {rel(ft, rf[:len(ft)]):.2e} | mlx {rel(fm, rf[:len(fm)]):.2e}") | |
| wt, wm = VT()(ft), VM()(ft) | |
| print(f"vocoder, MLX contra PyTorch (mesmas features): {rel(wm, wt):.2e} | rms {np.sqrt((wt ** 2).mean()) * 32768:.0f} / {np.sqrt((wm ** 2).mean()) * 32768:.0f}") | |