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 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use FermionResearch/Phonon-1 with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] huggingface-cli download --local-dir Phonon-1 FermionResearch/Phonon-1
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
Commit ·
bfafebe
0
Parent(s):
Phonon-1
Browse files- .gitattributes +7 -0
- LICENSE +202 -0
- NOTICE +60 -0
- README.md +69 -0
- config.json +74 -0
- package_release_bps.py +281 -0
- phonon-audio6.bps.tar.zst +3 -0
- verify_install.py +76 -0
.gitattributes
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LFS rules — commit this file FIRST, before any weight file (Neutrino 0.6B
|
| 2 |
+
# pattern; a file committed before its rule exists stays non-LFS forever).
|
| 3 |
+
# Never add a glob that a sibling small file would match: the Hub resolves LFS
|
| 4 |
+
# by "does any filter=lfs pattern match" and does NOT honour a later unset.
|
| 5 |
+
*.tar.zst filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.bin *.pt *.pth *.ckpt *.npz *.onnx *.msgpack *.tar *.tar.gz *.zip filter=lfs diff=lfs merge=lfs -text
|
LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
Apache License
|
| 3 |
+
Version 2.0, January 2004
|
| 4 |
+
http://www.apache.org/licenses/
|
| 5 |
+
|
| 6 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 7 |
+
|
| 8 |
+
1. Definitions.
|
| 9 |
+
|
| 10 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 11 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 12 |
+
|
| 13 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 14 |
+
the copyright owner that is granting the License.
|
| 15 |
+
|
| 16 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 17 |
+
other entities that control, are controlled by, or are under common
|
| 18 |
+
control with that entity. For the purposes of this definition,
|
| 19 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 20 |
+
direction or management of such entity, whether by contract or
|
| 21 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 22 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 23 |
+
|
| 24 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 25 |
+
exercising permissions granted by this License.
|
| 26 |
+
|
| 27 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 28 |
+
including but not limited to software source code, documentation
|
| 29 |
+
source, and configuration files.
|
| 30 |
+
|
| 31 |
+
"Object" form shall mean any form resulting from mechanical
|
| 32 |
+
transformation or translation of a Source form, including but
|
| 33 |
+
not limited to compiled object code, generated documentation,
|
| 34 |
+
and conversions to other media types.
|
| 35 |
+
|
| 36 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 37 |
+
Object form, made available under the License, as indicated by a
|
| 38 |
+
copyright notice that is included in or attached to the work
|
| 39 |
+
(an example is provided in the Appendix below).
|
| 40 |
+
|
| 41 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 42 |
+
form, that is based on (or derived from) the Work and for which the
|
| 43 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 44 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 45 |
+
of this License, Derivative Works shall not include works that remain
|
| 46 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 47 |
+
the Work and Derivative Works thereof.
|
| 48 |
+
|
| 49 |
+
"Contribution" shall mean any work of authorship, including
|
| 50 |
+
the original version of the Work and any modifications or additions
|
| 51 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 52 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 53 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 54 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 55 |
+
means any form of electronic, verbal, or written communication sent
|
| 56 |
+
to the Licensor or its representatives, including but not limited to
|
| 57 |
+
communication on electronic mailing lists, source code control systems,
|
| 58 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 59 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 60 |
+
excluding communication that is conspicuously marked or otherwise
|
| 61 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 62 |
+
|
| 63 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 64 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 65 |
+
subsequently incorporated within the Work.
|
| 66 |
+
|
| 67 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 68 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 69 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 70 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 71 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 72 |
+
Work and such Derivative Works in Source or Object form.
|
| 73 |
+
|
| 74 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 75 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 76 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 77 |
+
(except as stated in this section) patent license to make, have made,
|
| 78 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 79 |
+
where such license applies only to those patent claims licensable
|
| 80 |
+
by such Contributor that are necessarily infringed by their
|
| 81 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 82 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 83 |
+
institute patent litigation against any entity (including a
|
| 84 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 85 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 86 |
+
or contributory patent infringement, then any patent licenses
|
| 87 |
+
granted to You under this License for that Work shall terminate
|
| 88 |
+
as of the date such litigation is filed.
|
| 89 |
+
|
| 90 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 91 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 92 |
+
modifications, and in Source or Object form, provided that You
|
| 93 |
+
meet the following conditions:
|
| 94 |
+
|
| 95 |
+
(a) You must give any other recipients of the Work or
|
| 96 |
+
Derivative Works a copy of this License; and
|
| 97 |
+
|
| 98 |
+
(b) You must cause any modified files to carry prominent notices
|
| 99 |
+
stating that You changed the files; and
|
| 100 |
+
|
| 101 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 102 |
+
that You distribute, all copyright, patent, trademark, and
|
| 103 |
+
attribution notices from the Source form of the Work,
|
| 104 |
+
excluding those notices that do not pertain to any part of
|
| 105 |
+
the Derivative Works; and
|
| 106 |
+
|
| 107 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 108 |
+
distribution, then any Derivative Works that You distribute must
|
| 109 |
+
include a readable copy of the attribution notices contained
|
| 110 |
+
within such NOTICE file, excluding those notices that do not
|
| 111 |
+
pertain to any part of the Derivative Works, in at least one
|
| 112 |
+
of the following places: within a NOTICE text file distributed
|
| 113 |
+
as part of the Derivative Works; within the Source form or
|
| 114 |
+
documentation, if provided along with the Derivative Works; or,
|
| 115 |
+
within a display generated by the Derivative Works, if and
|
| 116 |
+
wherever such third-party notices normally appear. The contents
|
| 117 |
+
of the NOTICE file are for informational purposes only and
|
| 118 |
+
do not modify the License. You may add Your own attribution
|
| 119 |
+
notices within Derivative Works that You distribute, alongside
|
| 120 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 121 |
+
that such additional attribution notices cannot be construed
|
| 122 |
+
as modifying the License.
|
| 123 |
+
|
| 124 |
+
You may add Your own copyright statement to Your modifications and
|
| 125 |
+
may provide additional or different license terms and conditions
|
| 126 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 127 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 128 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 129 |
+
the conditions stated in this License.
|
| 130 |
+
|
| 131 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 132 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 133 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 134 |
+
this License, without any additional terms or conditions.
|
| 135 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 136 |
+
the terms of any separate license agreement you may have executed
|
| 137 |
+
with Licensor regarding such Contributions.
|
| 138 |
+
|
| 139 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 140 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 141 |
+
except as required for reasonable and customary use in describing the
|
| 142 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 143 |
+
|
| 144 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 145 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 146 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 147 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 148 |
+
implied, including, without limitation, any warranties or conditions
|
| 149 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 150 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 151 |
+
appropriateness of using or redistributing the Work and assume any
|
| 152 |
+
risks associated with Your exercise of permissions under this License.
|
| 153 |
+
|
| 154 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 155 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 156 |
+
unless required by applicable law (such as deliberate and grossly
|
| 157 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 158 |
+
liable to You for damages, including any direct, indirect, special,
|
| 159 |
+
incidental, or consequential damages of any character arising as a
|
| 160 |
+
result of this License or out of the use or inability to use the
|
| 161 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 162 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 163 |
+
other commercial damages or losses), even if such Contributor
|
| 164 |
+
has been advised of the possibility of such damages.
|
| 165 |
+
|
| 166 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 167 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 168 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 169 |
+
or other liability obligations and/or rights consistent with this
|
| 170 |
+
License. However, in accepting such obligations, You may act only
|
| 171 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 172 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 173 |
+
defend, and hold each Contributor harmless for any liability
|
| 174 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 175 |
+
of your accepting any such warranty or additional liability.
|
| 176 |
+
|
| 177 |
+
END OF TERMS AND CONDITIONS
|
| 178 |
+
|
| 179 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 180 |
+
|
| 181 |
+
To apply the Apache License to your work, attach the following
|
| 182 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 183 |
+
replaced with your own identifying information. (Don't include
|
| 184 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 185 |
+
comment syntax for the file format. We also recommend that a
|
| 186 |
+
file or class name and description of purpose be included on the
|
| 187 |
+
same "printed page" as the copyright notice for easier
|
| 188 |
+
identification within third-party archives.
|
| 189 |
+
|
| 190 |
+
Copyright [yyyy] [name of copyright owner]
|
| 191 |
+
|
| 192 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 193 |
+
you may not use this file except in compliance with the License.
|
| 194 |
+
You may obtain a copy of the License at
|
| 195 |
+
|
| 196 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 197 |
+
|
| 198 |
+
Unless required by applicable law or agreed to in writing, software
|
| 199 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 200 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 201 |
+
See the License for the specific language governing permissions and
|
| 202 |
+
limitations under the License.
|
NOTICE
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Phonon
|
| 2 |
+
Copyright 2026 Fermion Research
|
| 3 |
+
|
| 4 |
+
This product includes software and models developed by Fermion Research.
|
| 5 |
+
|
| 6 |
+
================================================================================
|
| 7 |
+
BASE MODEL
|
| 8 |
+
================================================================================
|
| 9 |
+
|
| 10 |
+
This model is derived from Qwen/Qwen3-ASR-0.6B, licensed under the
|
| 11 |
+
Apache License, Version 2.0.
|
| 12 |
+
|
| 13 |
+
https://huggingface.co/Qwen/Qwen3-ASR-0.6B
|
| 14 |
+
https://www.apache.org/licenses/LICENSE-2.0
|
| 15 |
+
|
| 16 |
+
The audio encoder architecture, tokenizer (vocab.json, merges.txt,
|
| 17 |
+
tokenizer_config.json), chat template, generation config and preprocessor
|
| 18 |
+
config derive from that model and remain under Apache-2.0.
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
================================================================================
|
| 22 |
+
BUNDLED SAMPLE AUDIO
|
| 23 |
+
================================================================================
|
| 24 |
+
|
| 25 |
+
samples/1089-134691-0000.flac
|
| 26 |
+
samples/1089-134691.trans.txt
|
| 27 |
+
|
| 28 |
+
From the LibriSpeech ASR corpus (Panayotov, Chen, Povey, Khudanpur;
|
| 29 |
+
ICASSP 2015; https://www.openslr.org/12/), licensed CC-BY 4.0.
|
| 30 |
+
Used as the runtime warm-up clip and as the quickstart example.
|
| 31 |
+
|
| 32 |
+
================================================================================
|
| 33 |
+
RUNTIME DEPENDENCIES
|
| 34 |
+
================================================================================
|
| 35 |
+
|
| 36 |
+
MLX ......................... MIT License ......... https://github.com/ml-explore/mlx
|
| 37 |
+
mlx-audio ................... MIT License ......... https://github.com/Blaizzy/mlx-audio
|
| 38 |
+
NumPy ....................... BSD-3-Clause ........ https://numpy.org
|
| 39 |
+
SciPy ....................... BSD-3-Clause ........ https://scipy.org
|
| 40 |
+
sounddevice ................. MIT License ......... https://github.com/spatialaudio/python-sounddevice
|
| 41 |
+
soundfile ................... BSD-3-Clause ........ https://github.com/bastibe/python-soundfile
|
| 42 |
+
soundfile links libsndfile (LGPL-2.1), dynamically and unmodified, as
|
| 43 |
+
distributed in the standard soundfile wheel.
|
| 44 |
+
|
| 45 |
+
================================================================================
|
| 46 |
+
OPTIONAL --punctuate DEPENDENCIES
|
| 47 |
+
================================================================================
|
| 48 |
+
|
| 49 |
+
Not installed by default. Required only for the display-only punctuation and
|
| 50 |
+
truecasing pass.
|
| 51 |
+
|
| 52 |
+
punctuators ................. Apache-2.0 .......... https://github.com/1-800-BAD-CODE/punctuators
|
| 53 |
+
onnxruntime ................. MIT License ......... https://onnxruntime.ai
|
| 54 |
+
|
| 55 |
+
Punctuation / truecasing / sentence-boundary models, all Apache-2.0, downloaded
|
| 56 |
+
on first use and run locally on CPU:
|
| 57 |
+
|
| 58 |
+
1-800-BAD-CODE/punctuation_fullstop_truecase_english
|
| 59 |
+
1-800-BAD-CODE/punct_cap_seg_47_language
|
| 60 |
+
1-800-BAD-CODE/xlm-roberta_punctuation_fullstop_truecase
|
README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: Qwen/Qwen3-ASR-0.6B
|
| 4 |
+
base_model_relation: quantized
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
library_name: mlx
|
| 8 |
+
pipeline_tag: automatic-speech-recognition
|
| 9 |
+
tags:
|
| 10 |
+
- mlx
|
| 11 |
+
- apple-silicon
|
| 12 |
+
- speech-to-text
|
| 13 |
+
- asr
|
| 14 |
+
- stt
|
| 15 |
+
- low-bit
|
| 16 |
+
- ternary
|
| 17 |
+
- quantization-aware-training
|
| 18 |
+
- on-device
|
| 19 |
+
- streaming
|
| 20 |
+
metrics:
|
| 21 |
+
- wer
|
| 22 |
+
---
|
| 23 |
+
|
| 24 |
+
# Phonon-1
|
| 25 |
+
|
| 26 |
+
Phonon-1 is an open speech recognition model for English. It downloads in
|
| 27 |
+
415 MB, runs on a laptop or a datacenter GPU, and transcribes an hour of audio
|
| 28 |
+
in about two and a half minutes. It was trained at 2.4 bits per weight from
|
| 29 |
+
the start, and it is the second model in the lab's low-bit lane after
|
| 30 |
+
Neutrino-1.
|
| 31 |
+
|
| 32 |
+
## Benchmarks
|
| 33 |
+
|
| 34 |
+
| Dataset | Phonon-1 (415 MB) | Phonon-1 Micro (285 MB) | Parakeet-0.6B 4-bit (637 MB) | Moonshine base (248 MB) | Whisper large-v3-turbo (1,619 MB) | Whisper small (967 MB) | wav2vec2-large (1,262 MB) | Qwen3-ASR teacher (1,569 MB) |
|
| 35 |
+
|---|---:|---:|---:|---:|---:|---:|---:|---:|
|
| 36 |
+
| LibriSpeech test-clean | 2.640 | 3.002 | 2.186 | 3.417 | 2.10 | 3.4† | 2.8† | 2.235 |
|
| 37 |
+
| LibriSpeech test-other | 5.699 | 6.511 | 3.937 | 8.262 | 4.07 | 7.6† | 6.3† | 4.618 |
|
| 38 |
+
| TED-LIUM | 3.421 | 3.878 | 2.829 | 5.272 | — | — | — | 2.889 |
|
| 39 |
+
| SPGISpeech | 4.163 | 4.858 | 4.104 | 5.731 | 2.79† | — | 13.31† | 3.074 |
|
| 40 |
+
| VoxPopuli | 8.394 | 9.177 | 6.345 | 10.470 | 11.22† | — | — | 7.151 |
|
| 41 |
+
| GigaSpeech | 11.396 | 11.882 | 9.614 | 12.114 | 8.52† | — | — | 9.321 |
|
| 42 |
+
| Earnings-22 | 12.571 | 14.771 | 11.190 | 17.872 | 11.07† | — | 36.28† | 11.188 |
|
| 43 |
+
| AMI | 13.084 | 14.094 | 12.723 | 17.790 | 15.16† | — | — | 12.560 |
|
| 44 |
+
| Macro (eight benchmarks) | 7.67 | 8.52 | 6.62 | 10.1 | — | — | — | 6.63 |
|
| 45 |
+
|
| 46 |
+
Word error rate, lower is better. Unmarked cells: measured by us — full test sets, Whisper English text normalizer, greedy decoding. † = published figure (model card, paper, or the Open ASR Leaderboard). Dash = no comparable measurement.
|
| 47 |
+
|
| 48 |
+
Median 23.9× realtime across nine corpora on a base M5 MacBook Air.
|
| 49 |
+
|
| 50 |
+
## Run it
|
| 51 |
+
|
| 52 |
+
```bash
|
| 53 |
+
pip install fermion-research
|
| 54 |
+
fermion transcribe recording.wav
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
```bash
|
| 58 |
+
fermion serve
|
| 59 |
+
curl -s http://127.0.0.1:8000/v1/audio/transcriptions \
|
| 60 |
+
-F "file=@recording.wav" \
|
| 61 |
+
-F "model=FermionResearch/Phonon-1"
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
The same weights run on a Mac (via MLX) or an NVIDIA GPU; the CUDA runtime and
|
| 65 |
+
Docker image are in the [GitHub repo](https://github.com/fermionresearch/phonon).
|
| 66 |
+
|
| 67 |
+
## License
|
| 68 |
+
|
| 69 |
+
**Apache License 2.0** for the weights and the [command line](https://pypi.org/project/fermion-research/). Base model: [`Qwen/Qwen3-ASR-0.6B`](https://huggingface.co/Qwen/Qwen3-ASR-0.6B), Apache-2.0.
|
config.json
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"config_schema": "fermion.phonon/1",
|
| 3 |
+
"model_id": "FermionResearch/Phonon-1",
|
| 4 |
+
"name": "Phonon-1",
|
| 5 |
+
"summary": "The default Phonon model. Statistically tied with Phonon-1 Big on accuracy at 71 % of the download.",
|
| 6 |
+
"license": "apache-2.0",
|
| 7 |
+
"library_name": "mlx",
|
| 8 |
+
"pipeline_tag": "automatic-speech-recognition",
|
| 9 |
+
"language": [
|
| 10 |
+
"en"
|
| 11 |
+
],
|
| 12 |
+
"base_model": "Qwen/Qwen3-ASR-0.6B",
|
| 13 |
+
"base_model_relation": "quantized",
|
| 14 |
+
"audio": {
|
| 15 |
+
"sample_rate": 16000,
|
| 16 |
+
"channels": 1,
|
| 17 |
+
"designed_utterance_seconds": [
|
| 18 |
+
0.5,
|
| 19 |
+
30.0
|
| 20 |
+
],
|
| 21 |
+
"punctuation": "native"
|
| 22 |
+
},
|
| 23 |
+
"runtime": {
|
| 24 |
+
"platform": "macOS on Apple silicon (arm64)",
|
| 25 |
+
"framework": "mlx"
|
| 26 |
+
},
|
| 27 |
+
"artifact": {
|
| 28 |
+
"profile": "audio6",
|
| 29 |
+
"backend": "audio6",
|
| 30 |
+
"filename": "phonon-audio6.bps.tar.zst",
|
| 31 |
+
"download_bytes": 415077202,
|
| 32 |
+
"sha256": "214c3b45aa57257013811a53f99a905848466ad4ab21f2b2f8368f7ac79427b2",
|
| 33 |
+
"unpacked_bytes": 454527730
|
| 34 |
+
},
|
| 35 |
+
"profiles": {
|
| 36 |
+
"default": "audio6",
|
| 37 |
+
"listed": [
|
| 38 |
+
"audio6"
|
| 39 |
+
],
|
| 40 |
+
"entries": [
|
| 41 |
+
{
|
| 42 |
+
"key": "audio6",
|
| 43 |
+
"name": "Audio6",
|
| 44 |
+
"backend": "audio6",
|
| 45 |
+
"filename": "phonon-audio6.bps.tar.zst",
|
| 46 |
+
"download_bytes": 415077202,
|
| 47 |
+
"sha256": "214c3b45aa57257013811a53f99a905848466ad4ab21f2b2f8368f7ac79427b2",
|
| 48 |
+
"unpacked_bytes": 454527730,
|
| 49 |
+
"listed": true
|
| 50 |
+
}
|
| 51 |
+
]
|
| 52 |
+
},
|
| 53 |
+
"family": [
|
| 54 |
+
{
|
| 55 |
+
"repo_id": "FermionResearch/Phonon-1-Big",
|
| 56 |
+
"name": "Phonon-1 Big",
|
| 57 |
+
"summary": "The largest Phonon build, and the quickest response of the three. Not the default: it costs 166 MB more than Phonon-1 for no measured accuracy gain."
|
| 58 |
+
},
|
| 59 |
+
{
|
| 60 |
+
"repo_id": "FermionResearch/Phonon-1",
|
| 61 |
+
"name": "Phonon-1",
|
| 62 |
+
"summary": "The default Phonon model. Statistically tied with Phonon-1 Big on accuracy at 71 % of the download."
|
| 63 |
+
},
|
| 64 |
+
{
|
| 65 |
+
"repo_id": "FermionResearch/Phonon-1-Micro",
|
| 66 |
+
"name": "Phonon-1 Micro",
|
| 67 |
+
"summary": "The smallest Phonon model, for the smallest install. It trades some accuracy for size."
|
| 68 |
+
}
|
| 69 |
+
],
|
| 70 |
+
"notes": [
|
| 71 |
+
"Accuracy and latency figures are published in README.md, not here, so that a card revision can never leave a stale number in machine-readable metadata.",
|
| 72 |
+
"The byte size and SHA-256 above describe this release and do not change for it. Check the archive against them before unpacking."
|
| 73 |
+
]
|
| 74 |
+
}
|
package_release_bps.py
ADDED
|
@@ -0,0 +1,281 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Byte-plane-split release packer/unpacker.
|
| 3 |
+
|
| 4 |
+
A BF16 array interleaves a highly predictable exponent byte with a near-random
|
| 5 |
+
mantissa byte. Compressed interleaved, zstd models neither population well.
|
| 6 |
+
Split into per-byte-position planes, the exponent plane compresses hard. U8
|
| 7 |
+
code planes are left untouched.
|
| 8 |
+
|
| 9 |
+
This is a *transport* transform only:
|
| 10 |
+
|
| 11 |
+
* the transform is applied per tensor, using the dtype in the safetensors
|
| 12 |
+
header, so it never has to guess;
|
| 13 |
+
* bytes not covered by any tensor (the header, alignment padding) are copied
|
| 14 |
+
verbatim;
|
| 15 |
+
* ``unpack`` reconstructs the original file and the manifest carries the
|
| 16 |
+
original SHA-256 and length of every member, so an install proves
|
| 17 |
+
byte-identity before anything is used.
|
| 18 |
+
|
| 19 |
+
Runtime tensors are therefore provably unchanged and accuracy cannot move.
|
| 20 |
+
|
| 21 |
+
python package_release_bps.py pack parity --level 19
|
| 22 |
+
python package_release_bps.py unpack local_stt/releases_bps/phonon-parity.bps.tar.zst DEST
|
| 23 |
+
python package_release_bps.py verify parity # full roundtrip proof
|
| 24 |
+
"""
|
| 25 |
+
|
| 26 |
+
from __future__ import annotations
|
| 27 |
+
|
| 28 |
+
import argparse
|
| 29 |
+
import hashlib
|
| 30 |
+
import io
|
| 31 |
+
import json
|
| 32 |
+
import subprocess
|
| 33 |
+
import tarfile
|
| 34 |
+
import tempfile
|
| 35 |
+
import time
|
| 36 |
+
from pathlib import Path
|
| 37 |
+
|
| 38 |
+
import numpy as np
|
| 39 |
+
|
| 40 |
+
ROOT = Path(__file__).resolve().parent
|
| 41 |
+
PROFILES = {
|
| 42 |
+
"parity": ROOT / "model_v18_mlx_quint5",
|
| 43 |
+
"micro": ROOT / "model_v18_mlx_hybrid4_quint5",
|
| 44 |
+
"audio6": ROOT / "model_v18_mlx_head8audio6_quint5",
|
| 45 |
+
}
|
| 46 |
+
ITEMSIZE = {"BOOL": 1, "U8": 1, "I8": 1, "U16": 2, "I16": 2, "F16": 2, "BF16": 2,
|
| 47 |
+
"U32": 4, "I32": 4, "F32": 4, "U64": 8, "I64": 8, "F64": 8, "F8_E4M3": 1,
|
| 48 |
+
"F8_E5M2": 1}
|
| 49 |
+
BLOCK = 16 << 20
|
| 50 |
+
FORMAT = "phonon-byteplane-tar-zstd-v1"
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
def sha256_bytes(data: bytes) -> str:
|
| 54 |
+
return hashlib.sha256(data).hexdigest()
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
def sha256_file(path: Path) -> str:
|
| 58 |
+
digest = hashlib.sha256()
|
| 59 |
+
with path.open("rb") as handle:
|
| 60 |
+
for chunk in iter(lambda: handle.read(BLOCK), b""):
|
| 61 |
+
digest.update(chunk)
|
| 62 |
+
return digest.hexdigest()
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def tensor_spans(raw: np.ndarray):
|
| 66 |
+
"""Return (base, [(start, end, itemsize), ...]) sorted, non-overlapping."""
|
| 67 |
+
header_len = int.from_bytes(raw[:8].tobytes(), "little")
|
| 68 |
+
header = json.loads(raw[8:8 + header_len].tobytes())
|
| 69 |
+
base = 8 + header_len
|
| 70 |
+
spans = []
|
| 71 |
+
for name, meta in header.items():
|
| 72 |
+
if name == "__metadata__":
|
| 73 |
+
continue
|
| 74 |
+
start, end = meta["data_offsets"]
|
| 75 |
+
itemsize = ITEMSIZE[meta["dtype"]]
|
| 76 |
+
if itemsize > 1 and (end - start) % itemsize == 0:
|
| 77 |
+
spans.append((int(start), int(end), itemsize))
|
| 78 |
+
spans.sort()
|
| 79 |
+
merged = []
|
| 80 |
+
last_end = 0
|
| 81 |
+
for start, end, itemsize in spans:
|
| 82 |
+
if start < last_end: # overlapping/aliased tensors
|
| 83 |
+
continue
|
| 84 |
+
merged.append((start, end, itemsize))
|
| 85 |
+
last_end = end
|
| 86 |
+
return base, merged
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
def split_file(path: Path) -> tuple[bytes, dict]:
|
| 90 |
+
raw = np.fromfile(path, dtype=np.uint8)
|
| 91 |
+
base, spans = tensor_spans(raw)
|
| 92 |
+
out = io.BytesIO()
|
| 93 |
+
out.write(raw[:base].tobytes()) # header verbatim
|
| 94 |
+
cursor = 0
|
| 95 |
+
plan = []
|
| 96 |
+
for start, end, itemsize in spans:
|
| 97 |
+
if start > cursor: # padding / uncovered bytes
|
| 98 |
+
out.write(raw[base + cursor: base + start].tobytes())
|
| 99 |
+
chunk = raw[base + start: base + end]
|
| 100 |
+
for i in range(itemsize):
|
| 101 |
+
out.write(chunk[i::itemsize].tobytes())
|
| 102 |
+
plan.append([start, end, itemsize])
|
| 103 |
+
cursor = end
|
| 104 |
+
tail = raw[base + cursor:]
|
| 105 |
+
if tail.size:
|
| 106 |
+
out.write(tail.tobytes())
|
| 107 |
+
meta = {
|
| 108 |
+
"base": base,
|
| 109 |
+
"plan": plan,
|
| 110 |
+
"payload_bytes": int(raw.size - base),
|
| 111 |
+
"original_bytes": int(raw.size),
|
| 112 |
+
"original_sha256": sha256_bytes(raw.tobytes()),
|
| 113 |
+
}
|
| 114 |
+
return out.getvalue(), meta
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
def join_file(data: bytes, meta: dict) -> bytes:
|
| 118 |
+
raw = np.frombuffer(data, dtype=np.uint8)
|
| 119 |
+
base = meta["base"]
|
| 120 |
+
out = np.empty(meta["original_bytes"], dtype=np.uint8)
|
| 121 |
+
out[:base] = raw[:base]
|
| 122 |
+
src = base
|
| 123 |
+
cursor = 0
|
| 124 |
+
for start, end, itemsize in meta["plan"]:
|
| 125 |
+
if start > cursor:
|
| 126 |
+
width = start - cursor
|
| 127 |
+
out[base + cursor: base + start] = raw[src: src + width]
|
| 128 |
+
src += width
|
| 129 |
+
n = end - start
|
| 130 |
+
per = n // itemsize
|
| 131 |
+
block = raw[src: src + n].reshape(itemsize, per)
|
| 132 |
+
out[base + start: base + end] = block.T.reshape(-1)
|
| 133 |
+
src += n
|
| 134 |
+
cursor = end
|
| 135 |
+
remaining = meta["payload_bytes"] - cursor
|
| 136 |
+
if remaining:
|
| 137 |
+
out[base + cursor:] = raw[src: src + remaining]
|
| 138 |
+
return out.tobytes()
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
def tar_info(name: str, size: int) -> tarfile.TarInfo:
|
| 142 |
+
info = tarfile.TarInfo(name)
|
| 143 |
+
info.size = size
|
| 144 |
+
info.mtime = 0
|
| 145 |
+
info.mode = 0o644
|
| 146 |
+
info.uid = info.gid = 0
|
| 147 |
+
info.uname = info.gname = ""
|
| 148 |
+
return info
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
def pack(profile: str, level: int, out_dir: Path) -> dict:
|
| 152 |
+
source = PROFILES[profile]
|
| 153 |
+
out_dir.mkdir(parents=True, exist_ok=True)
|
| 154 |
+
archive = out_dir / f"phonon-{profile}.bps.tar.zst"
|
| 155 |
+
|
| 156 |
+
members = sorted(p for p in source.rglob("*") if p.is_file())
|
| 157 |
+
manifest = {
|
| 158 |
+
"release_format": FORMAT,
|
| 159 |
+
"profile": profile,
|
| 160 |
+
"compression": {"codec": "zstd", "level": level},
|
| 161 |
+
"transform": "byte-plane-split-per-tensor-v1",
|
| 162 |
+
"files": [],
|
| 163 |
+
}
|
| 164 |
+
payloads: list[tuple[str, bytes]] = []
|
| 165 |
+
for path in members:
|
| 166 |
+
rel = str(path.relative_to(source))
|
| 167 |
+
blob = path.read_bytes()
|
| 168 |
+
entry = {"path": rel, "original_bytes": len(blob),
|
| 169 |
+
"original_sha256": sha256_bytes(blob)}
|
| 170 |
+
if path.name.startswith("model-") and path.suffix == ".safetensors":
|
| 171 |
+
transformed, meta = split_file(path)
|
| 172 |
+
entry["transform"] = meta
|
| 173 |
+
entry["stored_bytes"] = len(transformed)
|
| 174 |
+
payloads.append((rel + ".bps", transformed))
|
| 175 |
+
else:
|
| 176 |
+
entry["stored_bytes"] = len(blob)
|
| 177 |
+
payloads.append((rel, blob))
|
| 178 |
+
manifest["files"].append(entry)
|
| 179 |
+
|
| 180 |
+
manifest_bytes = (json.dumps(manifest, indent=2, sort_keys=True) + "\n").encode()
|
| 181 |
+
started = time.perf_counter()
|
| 182 |
+
args = ["zstd", "-q", f"-{level}", "-T0", "-f", "-o", str(archive), "-"]
|
| 183 |
+
if level >= 20:
|
| 184 |
+
args.insert(1, "--ultra")
|
| 185 |
+
process = subprocess.Popen(args, stdin=subprocess.PIPE)
|
| 186 |
+
assert process.stdin is not None
|
| 187 |
+
with tarfile.open(fileobj=process.stdin, mode="w|") as tar:
|
| 188 |
+
tar.addfile(tar_info("bps_manifest.json", len(manifest_bytes)),
|
| 189 |
+
io.BytesIO(manifest_bytes))
|
| 190 |
+
for name, blob in payloads:
|
| 191 |
+
tar.addfile(tar_info(name, len(blob)), io.BytesIO(blob))
|
| 192 |
+
process.stdin.close()
|
| 193 |
+
if process.wait() != 0:
|
| 194 |
+
raise RuntimeError("zstd failed")
|
| 195 |
+
pack_s = time.perf_counter() - started
|
| 196 |
+
return {"profile": profile, "archive": str(archive),
|
| 197 |
+
"archive_bytes": archive.stat().st_size,
|
| 198 |
+
"source_bytes": sum(p.stat().st_size for p in members),
|
| 199 |
+
"level": level, "pack_seconds": pack_s,
|
| 200 |
+
"archive_sha256": sha256_file(archive)}
|
| 201 |
+
|
| 202 |
+
|
| 203 |
+
def unpack(archive: Path, dest: Path) -> dict:
|
| 204 |
+
dest.mkdir(parents=True, exist_ok=True)
|
| 205 |
+
started = time.perf_counter()
|
| 206 |
+
process = subprocess.Popen(["zstd", "-q", "-d", "-c", str(archive)],
|
| 207 |
+
stdout=subprocess.PIPE)
|
| 208 |
+
assert process.stdout is not None
|
| 209 |
+
manifest = None
|
| 210 |
+
written = []
|
| 211 |
+
with tarfile.open(fileobj=process.stdout, mode="r|") as tar:
|
| 212 |
+
for member in tar:
|
| 213 |
+
handle = tar.extractfile(member)
|
| 214 |
+
if handle is None:
|
| 215 |
+
continue
|
| 216 |
+
blob = handle.read()
|
| 217 |
+
if member.name == "bps_manifest.json":
|
| 218 |
+
manifest = json.loads(blob)
|
| 219 |
+
index = {row["path"]: row for row in manifest["files"]}
|
| 220 |
+
continue
|
| 221 |
+
if manifest is None:
|
| 222 |
+
raise RuntimeError("bps_manifest.json must be the first member")
|
| 223 |
+
rel = member.name[:-4] if member.name.endswith(".bps") else member.name
|
| 224 |
+
row = index[rel]
|
| 225 |
+
data = join_file(blob, row["transform"]) if "transform" in row else blob
|
| 226 |
+
got = sha256_bytes(data)
|
| 227 |
+
if got != row["original_sha256"] or len(data) != row["original_bytes"]:
|
| 228 |
+
raise RuntimeError(f"checksum mismatch on {rel}")
|
| 229 |
+
target = dest / rel
|
| 230 |
+
target.parent.mkdir(parents=True, exist_ok=True)
|
| 231 |
+
target.write_bytes(data)
|
| 232 |
+
written.append(rel)
|
| 233 |
+
if process.wait() != 0:
|
| 234 |
+
raise RuntimeError("zstd decompression failed")
|
| 235 |
+
missing = {row["path"] for row in manifest["files"]} - set(written)
|
| 236 |
+
if missing:
|
| 237 |
+
raise RuntimeError(f"archive is missing members: {sorted(missing)}")
|
| 238 |
+
return {"files": len(written), "unpack_seconds": time.perf_counter() - started}
|
| 239 |
+
|
| 240 |
+
|
| 241 |
+
def verify(profile: str, level: int, out_dir: Path) -> dict:
|
| 242 |
+
"""Pack, unpack to a temporary directory, and prove byte-identity."""
|
| 243 |
+
packed = pack(profile, level, out_dir)
|
| 244 |
+
source = PROFILES[profile]
|
| 245 |
+
with tempfile.TemporaryDirectory() as tmp:
|
| 246 |
+
stats = unpack(Path(packed["archive"]), Path(tmp))
|
| 247 |
+
mismatched = []
|
| 248 |
+
for path in sorted(p for p in source.rglob("*") if p.is_file()):
|
| 249 |
+
rel = path.relative_to(source)
|
| 250 |
+
other = Path(tmp) / rel
|
| 251 |
+
if not other.exists() or sha256_file(other) != sha256_file(path):
|
| 252 |
+
mismatched.append(str(rel))
|
| 253 |
+
packed.update(stats)
|
| 254 |
+
packed["roundtrip_byte_identical"] = not mismatched
|
| 255 |
+
packed["mismatched"] = mismatched
|
| 256 |
+
return packed
|
| 257 |
+
|
| 258 |
+
|
| 259 |
+
def main() -> None:
|
| 260 |
+
ap = argparse.ArgumentParser()
|
| 261 |
+
ap.add_argument("command", choices=("pack", "unpack", "verify"))
|
| 262 |
+
ap.add_argument("target")
|
| 263 |
+
ap.add_argument("dest", nargs="?")
|
| 264 |
+
ap.add_argument("--level", type=int, default=19)
|
| 265 |
+
ap.add_argument("--out-dir", type=Path, default=ROOT / "releases_bps")
|
| 266 |
+
args = ap.parse_args()
|
| 267 |
+
|
| 268 |
+
if args.command == "unpack":
|
| 269 |
+
print(json.dumps(unpack(Path(args.target), Path(args.dest)), indent=2))
|
| 270 |
+
return
|
| 271 |
+
fn = pack if args.command == "pack" else verify
|
| 272 |
+
result = fn(args.target, args.level, args.out_dir)
|
| 273 |
+
ratio = 100 * result["archive_bytes"] / result["source_bytes"]
|
| 274 |
+
result["percent_of_source"] = ratio
|
| 275 |
+
print(json.dumps(result, indent=2, sort_keys=True))
|
| 276 |
+
print(f"{args.target}: {result['source_bytes']/1e6:.1f} MB -> "
|
| 277 |
+
f"{result['archive_bytes']/1e6:.1f} MB ({ratio:.2f}%)")
|
| 278 |
+
|
| 279 |
+
|
| 280 |
+
if __name__ == "__main__":
|
| 281 |
+
main()
|
phonon-audio6.bps.tar.zst
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:214c3b45aa57257013811a53f99a905848466ad4ab21f2b2f8368f7ac79427b2
|
| 3 |
+
size 415077202
|
verify_install.py
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Verify a Phonon deployment artifact without loading or mutating it."""
|
| 3 |
+
|
| 4 |
+
from __future__ import annotations
|
| 5 |
+
|
| 6 |
+
import argparse
|
| 7 |
+
import hashlib
|
| 8 |
+
import json
|
| 9 |
+
import platform
|
| 10 |
+
import sys
|
| 11 |
+
from pathlib import Path
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
ROOT = Path(__file__).resolve().parent
|
| 15 |
+
MODELS = {
|
| 16 |
+
"parity": ROOT / "model_v18_mlx_quint5",
|
| 17 |
+
"audio6": ROOT / "model_v18_mlx_head8audio6_quint5",
|
| 18 |
+
"micro": ROOT / "model_v18_mlx_hybrid4_quint5",
|
| 19 |
+
}
|
| 20 |
+
# The three published models, and the only values shown in `--help`.
|
| 21 |
+
PUBLIC_PROFILES = ("parity", "audio6", "micro")
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def sha256(path: Path) -> str:
|
| 25 |
+
digest = hashlib.sha256()
|
| 26 |
+
with path.open("rb") as handle:
|
| 27 |
+
while chunk := handle.read(8 << 20):
|
| 28 |
+
digest.update(chunk)
|
| 29 |
+
return digest.hexdigest()
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
def main() -> int:
|
| 33 |
+
parser = argparse.ArgumentParser()
|
| 34 |
+
# Every key in MODELS stays valid; only the three published models are
|
| 35 |
+
# advertised. `metavar` controls the help text, `choices` controls what is
|
| 36 |
+
# accepted, so the unpublished ones remain checkable by name.
|
| 37 |
+
parser.add_argument(
|
| 38 |
+
"--profile",
|
| 39 |
+
choices=MODELS,
|
| 40 |
+
metavar="{" + ",".join(PUBLIC_PROFILES) + "}",
|
| 41 |
+
default="audio6",
|
| 42 |
+
)
|
| 43 |
+
args = parser.parse_args()
|
| 44 |
+
model = MODELS[args.profile]
|
| 45 |
+
if platform.machine() != "arm64":
|
| 46 |
+
raise RuntimeError("the optimized local runtime requires Apple Silicon")
|
| 47 |
+
manifest = json.loads((model / "packed_manifest.json").read_text())
|
| 48 |
+
if manifest.get("status") != "PASS":
|
| 49 |
+
raise RuntimeError("packed manifest is not PASS")
|
| 50 |
+
if manifest.get("source_checkpoint_sha256") != (
|
| 51 |
+
"27f01f214a0c0916944118458d0f43791b5377431fb6a230d7a2f4248368a49e"
|
| 52 |
+
):
|
| 53 |
+
raise RuntimeError("this artifact does not match the published Phonon-1 release checkpoint")
|
| 54 |
+
if len(manifest.get("modules", [])) != 196:
|
| 55 |
+
raise RuntimeError("expected 196 packed decoder layers")
|
| 56 |
+
total = 0
|
| 57 |
+
for row in manifest["shards"]:
|
| 58 |
+
path = model / row["name"]
|
| 59 |
+
if path.stat().st_size != row["bytes"]:
|
| 60 |
+
raise RuntimeError(f"size mismatch: {path.name}")
|
| 61 |
+
actual = sha256(path)
|
| 62 |
+
if actual != row["sha256"]:
|
| 63 |
+
raise RuntimeError(f"SHA-256 mismatch: {path.name}")
|
| 64 |
+
total += path.stat().st_size
|
| 65 |
+
print(f"PASS {path.name} {actual[:16]}…")
|
| 66 |
+
if total != manifest["total_bytes"]:
|
| 67 |
+
raise RuntimeError("packed byte total mismatch")
|
| 68 |
+
print(
|
| 69 |
+
f"PASS Phonon {args.profile} model: {len(manifest['modules'])} linears, "
|
| 70 |
+
f"{total / 1e9:.3f} GB"
|
| 71 |
+
)
|
| 72 |
+
return 0
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
if __name__ == "__main__":
|
| 76 |
+
sys.exit(main())
|