|
Download README.md from FermionResearch/Phonon-2.5-CoreML: direct link, hf CLI and curl.
- Browser
- Download file 7.07 kB
-
https://huggingface.co/FermionResearch/Phonon-2.5-CoreML/resolve/main/README.md
- Command line
-
hf download hf://FermionResearch/Phonon-2.5-CoreML/README.md
-
curl -L -o README.md https://huggingface.co/FermionResearch/Phonon-2.5-CoreML/resolve/main/README.md
7.07 kB
| license: cc-by-4.0 | |
| base_model: FermionResearch/Phonon-2.5 | |
| base_model_relation: quantized | |
| language: | |
| - en | |
| - de | |
| - fr | |
| - es | |
| - it | |
| - pt | |
| - nl | |
| - pl | |
| - cs | |
| - sk | |
| - hu | |
| - ro | |
| - bg | |
| - el | |
| - ru | |
| - uk | |
| - hr | |
| - sl | |
| - lv | |
| - lt | |
| - et | |
| - fi | |
| - sv | |
| - da | |
| - mt | |
| library_name: coreml | |
| pipeline_tag: automatic-speech-recognition | |
| tags: | |
| - coreml | |
| - neural-engine | |
| - apple-silicon | |
| - speech-to-text | |
| - asr | |
| - stt | |
| - on-device | |
| - multilingual | |
| metrics: | |
| - wer | |
| # Phonon-2.5 Core ML | |
| Phonon-2.5 for the Apple Neural Engine. Phonon-2.5 transcribes 25 European languages with punctuation and casing; the language is not declared, the model hears it. This package carries the Phonon-2.5 weights exactly: on a | |
| 420-utterance gate set its transcripts are identical to the Phonon-2.5 reference engine's on 394, and the rest differ only by | |
| 16-bit float rounding (accuracy below). | |
| One 333 MB package holds the encoder for every utterance up to 35 seconds, over a single set of weights; the | |
| decoder is a 13 MB table file. Every word carries its start and end time, and the GPU stays free. | |
| ## Run it | |
| macOS 15 or later on Apple silicon. The runtime ships compiled in `bin/`. | |
| **Command line** | |
| ```bash | |
| hf download FermionResearch/Phonon-2.5-CoreML --local-dir Phonon-2.5-CoreML | |
| chmod +x Phonon-2.5-CoreML/bin/phonon-coreml-cli | |
| Phonon-2.5-CoreML/bin/phonon-coreml-cli Phonon-2.5-CoreML recording.wav --words | |
| ``` | |
| **Swift**: add `bin/PhononCoreML.xcframework.zip` (unzipped) to your target as a binary framework. | |
| ```swift | |
| import PhononCoreML | |
| let transcriber = try Transcriber(bundle: URL(fileURLWithPath: "Phonon-2.5-CoreML")) // the folder this repository downloads to | |
| let result = try transcriber.transcribe(url: URL(fileURLWithPath: "recording.wav")) | |
| print(result.text) | |
| for word in result.words { print(word.start, word.end, word.text) } | |
| ``` | |
| **C, Python and other languages**: `bin/libphonon_coreml.dylib` with the C header `bin/include/phonon_coreml.h`. From Python, with | |
| nothing to install, run from the downloaded folder: | |
| ```python | |
| import ctypes, json, sys | |
| lib = ctypes.CDLL("bin/libphonon_coreml.dylib") | |
| lib.pcm_open.restype = ctypes.c_void_p | |
| lib.pcm_open.argtypes = [ctypes.c_char_p, ctypes.c_int32, ctypes.c_int32, ctypes.c_char_p, ctypes.c_int32] | |
| lib.pcm_transcribe_long.restype = ctypes.c_void_p | |
| lib.pcm_transcribe_long.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_void_p, ctypes.c_int64, ctypes.c_int32, | |
| ctypes.c_double, ctypes.c_double, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, | |
| ctypes.c_char_p, ctypes.c_int32] | |
| lib.pcm_free.argtypes = [ctypes.c_void_p] | |
| err = ctypes.create_string_buffer(1024) | |
| h = lib.pcm_open(b".", 4, 0, err, len(err)) # this folder; 4 decoder threads; Neural Engine | |
| if not h: sys.exit(err.value.decode()) | |
| p = lib.pcm_transcribe_long(h, sys.argv[1].encode(), None, 0, 1, 0, 0, None, None, None, err, len(err)) | |
| if not p: sys.exit(err.value.decode()) | |
| result = json.loads(ctypes.string_at(p).decode()); lib.pcm_free(p) | |
| print(result["text"]) | |
| for w in result["words"]: print(w["start"], w["end"], w["text"]) | |
| ``` | |
| All three take 16 kHz audio of any length (stereo is mixed down). The first run prepares the package for the Neural Engine once (about 50 seconds before the first transcript and about 3 minutes for all four windows on an M5 MacBook Air); the | |
| prepared copy is kept, so later loads take about a second. | |
| Phonon-2.5 also runs through the `fermion` command line on Apple silicon, Linux, Windows and NVIDIA GPUs. See the | |
| [Phonon-2.5 card](https://huggingface.co/FermionResearch/Phonon-2.5). | |
| ## Smaller download | |
| If the `model.fermion` file of Phonon-2.5 (the file the `fermion` runtime keeps) is already on the machine, the | |
| package can be built from it instead of downloaded: fetch only the small files (≈39 MB) and expand. The result is checked byte for | |
| byte against the published package before it is written. | |
| ```bash | |
| hf download FermionResearch/Phonon-2.5-CoreML --local-dir Phonon-2.5-CoreML --exclude "Phonon-2.5.mlpackage/*" | |
| chmod +x Phonon-2.5-CoreML/bin/phonon-coreml-cli | |
| Phonon-2.5-CoreML/bin/phonon-coreml-cli --expand model.fermion Phonon-2.5-CoreML/kit Phonon-2.5-CoreML/Phonon-2.5.mlpackage | |
| ``` | |
| Expansion takes about 2 seconds. From C: `pcm_expand(container, kit_dir, out_package, 0, err, errlen)`. | |
| ## Long audio and the leading pad | |
| An utterance of up to 35 seconds is read in one pass by the smallest encoder window that holds it. Longer recordings are cut at | |
| pauses into windows of up to 15 seconds and their words are joined, so no word is split at a boundary. Pass recordings whole; the | |
| runtime does the cutting. | |
| Every window is encoded with a quarter second of silence in front of it (`leading_pad_s` in `manifest.json`), the runtime default of | |
| Phonon-2.5: a recording that starts in the middle of a word is then read from its first word. Word times are reported on the | |
| recording's own clock. | |
| ## Accuracy | |
| Word error rate, %, lower is better: this package on the Neural Engine beside the Phonon-2.5 reference engine on the same utterances. | |
| English sets are scored with the Open ASR Leaderboard's own code; FLEURS with a case- and punctuation-insensitive word error rate. | |
| The [Phonon-2.5 card](https://huggingface.co/FermionResearch/Phonon-2.5) lists the full-set accuracy in every language. | |
| | Set | Core ML, Neural Engine | Reference engine | | |
| |---|---:|---:| | |
| | Open ASR Leaderboard English sets (280-utterance sample of the seven sets) | 6.18 | 6.07 | | |
| | LibriSpeech test-clean (40 utterances) | 2.07 | 2.07 | | |
| | FLEURS, 8 languages (96 utterances) | 7.41 | 7.32 | | |
| | One hour of LibriSpeech read as one file | 1.11 | | | |
| ## Speed | |
| M5 MacBook Air, Neural Engine, package loaded: | |
| | | | | |
| |---|---| | |
| | Long audio | One hour of audio in under 6 seconds (625× real time) | | |
| | A 3 to 5 second utterance | 8 ms | | |
| | Later loads (all four windows) | about a second | | |
| | Memory while reading an hour | 0.14 GB | | |
| ## Files | |
| | File | Size | Contents | | |
| |---|---:|---| | |
| | `Phonon-2.5.mlpackage` | 333 MB | the encoder for 5, 10, 15 and 35 second windows over one shared weight set (the weights stored exactly) | | |
| | `decoder.bin` | 13 MB | the prediction network, joint and vocabulary | | |
| | `manifest.json` | | source checksum, window lengths, the leading pad and the input contract | | |
| | `kit/` | 26 MB | what `--expand` needs to build `Phonon-2.5.mlpackage` from `model.fermion` | | |
| | `bin/` | 1 MB | `phonon-coreml-cli`, `libphonon_coreml.dylib` + `include/phonon_coreml.h`, `PhononCoreML.xcframework.zip` (macOS, arm64) | | |
| | `ci/` | | three LibriSpeech clips and their transcripts, for a quick check | | |
| | `NOTICE`, `LICENSE-*` | | attribution, the weights licence and the runtime licence | | |
| | `SHA256SUMS` | | a checksum for every file above | | |
| ## Licence | |
| The weights are released under CC-BY-4.0. They derive from NVIDIA's parakeet-tdt-0.6b-v3, whose tokenizer and output | |
| conventions (punctuation, casing, numerals) they keep, and `NOTICE` lists the changes. The runtime in `bin/` is distributed in | |
| compiled form under the Apache License 2.0 (`LICENSE-RUNTIME-Apache-2.0.txt`). | |