Automatic Speech Recognition
MLX
English
apple-silicon
speech-to-text
asr
stt
low-bit
ternary
quantization-aware-training
on-device
streaming
Instructions to use FermionResearch/Phonon-1-Micro with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use FermionResearch/Phonon-1-Micro with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] huggingface-cli download --local-dir Phonon-1-Micro FermionResearch/Phonon-1-Micro
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
File size: 2,608 Bytes
84303e4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | #!/usr/bin/env python3
"""Verify a Phonon deployment artifact without loading or mutating it."""
from __future__ import annotations
import argparse
import hashlib
import json
import platform
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parent
MODELS = {
"parity": ROOT / "model_v18_mlx_quint5",
"audio6": ROOT / "model_v18_mlx_head8audio6_quint5",
"micro": ROOT / "model_v18_mlx_hybrid4_quint5",
}
# The three published models, and the only values shown in `--help`.
PUBLIC_PROFILES = ("parity", "audio6", "micro")
def sha256(path: Path) -> str:
digest = hashlib.sha256()
with path.open("rb") as handle:
while chunk := handle.read(8 << 20):
digest.update(chunk)
return digest.hexdigest()
def main() -> int:
parser = argparse.ArgumentParser()
# Every key in MODELS stays valid; only the three published models are
# advertised. `metavar` controls the help text, `choices` controls what is
# accepted, so the unpublished ones remain checkable by name.
parser.add_argument(
"--profile",
choices=MODELS,
metavar="{" + ",".join(PUBLIC_PROFILES) + "}",
default="audio6",
)
args = parser.parse_args()
model = MODELS[args.profile]
if platform.machine() != "arm64":
raise RuntimeError("the optimized local runtime requires Apple Silicon")
manifest = json.loads((model / "packed_manifest.json").read_text())
if manifest.get("status") != "PASS":
raise RuntimeError("packed manifest is not PASS")
if manifest.get("source_checkpoint_sha256") != (
"27f01f214a0c0916944118458d0f43791b5377431fb6a230d7a2f4248368a49e"
):
raise RuntimeError("this artifact does not match the published Phonon-1 release checkpoint")
if len(manifest.get("modules", [])) != 196:
raise RuntimeError("expected 196 packed decoder layers")
total = 0
for row in manifest["shards"]:
path = model / row["name"]
if path.stat().st_size != row["bytes"]:
raise RuntimeError(f"size mismatch: {path.name}")
actual = sha256(path)
if actual != row["sha256"]:
raise RuntimeError(f"SHA-256 mismatch: {path.name}")
total += path.stat().st_size
print(f"PASS {path.name} {actual[:16]}…")
if total != manifest["total_bytes"]:
raise RuntimeError("packed byte total mismatch")
print(
f"PASS Phonon {args.profile} model: {len(manifest['modules'])} linears, "
f"{total / 1e9:.3f} GB"
)
return 0
if __name__ == "__main__":
sys.exit(main())
|