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/pingo_edge/acoustic_mlx_edge.py from semfence/pingo-ptbr-edge: direct link, hf CLI and curl.
- Browser
- Download file 839 Bytes
-
https://huggingface.co/semfence/pingo-ptbr-edge/resolve/main/python/pingo_edge/acoustic_mlx_edge.py
- Command line
-
hf download hf://semfence/pingo-ptbr-edge/python/pingo_edge/acoustic_mlx_edge.py
-
curl -L -o acoustic_mlx_edge.py https://huggingface.co/semfence/pingo-ptbr-edge/resolve/main/python/pingo_edge/acoustic_mlx_edge.py
839 Bytes
| """Pingo acoustic model in MLX with the firmware's 4-bit weights, dequantized.""" | |
| import numpy as np | |
| import mlx.core as mx | |
| from mlx.utils import tree_flatten, tree_unflatten | |
| from . import weights as W | |
| from . import acoustic_mlx as A | |
| class AcousticMLX: | |
| def __init__(self, path=W.DEFAULT): | |
| z, meta = W.load(path); cfg, ac = W.acoustic(z, meta) | |
| self.cfg = cfg; self.model = A.Acoustic(cfg) | |
| flat = [(k, mx.array(np.ascontiguousarray(ac[W.cname(k)].reshape(v.shape)))) for k, v in tree_flatten(self.model.parameters())] | |
| self.model.update(tree_unflatten(flat)); mx.eval(self.model.parameters()) | |
| def features(self, ids, stress, voice, speed=1.0, phone_mask=None): | |
| return A.acoustic_features(self.model, [int(i) for i in ids], [int(i) for i in stress], int(voice), speed, np.asarray(phone_mask)) | |