Add the Core ML encoder (int8, int4) and decoder (fp16, int8), README and config
Browse files
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
*.pte filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -2,4 +2,83 @@
|
|
| 2 |
license: other
|
| 3 |
license_name: higgs-audio-v2-tokenizer-license
|
| 4 |
license_link: https://huggingface.co/bosonai/higgs-audio-v2-tokenizer/blob/main/LICENSE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
license: other
|
| 3 |
license_name: higgs-audio-v2-tokenizer-license
|
| 4 |
license_link: https://huggingface.co/bosonai/higgs-audio-v2-tokenizer/blob/main/LICENSE
|
| 5 |
+
base_model:
|
| 6 |
+
- bosonai/higgs-audio-v2-tokenizer
|
| 7 |
+
library_name: executorch
|
| 8 |
+
tags:
|
| 9 |
+
- audio
|
| 10 |
+
- audio-tokenizer
|
| 11 |
---
|
| 12 |
+
|
| 13 |
+
# higgs-audio-v2-tokenizer
|
| 14 |
+
|
| 15 |
+
This repository hosts the **higgs-audio-v2-tokenizer** models exported for the
|
| 16 |
+
[React Native ExecuTorch](https://www.npmjs.com/package/react-native-executorch)
|
| 17 |
+
library as ExecuTorch `.pte` programs, ready to run on device.
|
| 18 |
+
|
| 19 |
+
Upstream model: [Higgs Audio v2 tokenizer](https://huggingface.co/bosonai/higgs-audio-v2-tokenizer)
|
| 20 |
+
|
| 21 |
+
## Variants
|
| 22 |
+
|
| 23 |
+
| Path | Component | Backend | Precision |
|
| 24 |
+
| --- | --- | --- | --- |
|
| 25 |
+
| `coreml/decoder/fp16/codec_decoder_coreml_fp16.pte` | decoder | coreml | fp16 |
|
| 26 |
+
| `coreml/decoder/int8/codec_decoder_coreml_int8.pte` | decoder | coreml | int8 |
|
| 27 |
+
| `coreml/encoder/int4/codec_encoder_coreml_int4.pte` | encoder | coreml | int4 |
|
| 28 |
+
| `coreml/encoder/int8/codec_encoder_coreml_int8.pte` | encoder | coreml | int8 |
|
| 29 |
+
|
| 30 |
+
## Repository structure
|
| 31 |
+
|
| 32 |
+
```
|
| 33 |
+
config.json 46 B
|
| 34 |
+
coreml/decoder/fp16/codec_decoder_coreml_fp16.pte 43.6 MB
|
| 35 |
+
coreml/decoder/int8/codec_decoder_coreml_int8.pte 23.3 MB
|
| 36 |
+
coreml/encoder/int4/codec_encoder_coreml_int4.pte 136 MB
|
| 37 |
+
coreml/encoder/int8/codec_encoder_coreml_int8.pte 176 MB
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
## Compatibility
|
| 41 |
+
|
| 42 |
+
These files are published for the **ExecuTorch v1.4.1** runtime. ExecuTorch
|
| 43 |
+
gives no forward compatibility guarantee, so an older runtime may fail to load
|
| 44 |
+
them.
|
| 45 |
+
|
| 46 |
+
To use them in React Native ExecuTorch, pass the model constant shipped in the
|
| 47 |
+
library's model registry to the corresponding task pipeline. See the
|
| 48 |
+
[documentation](https://docs.swmansion.com/react-native-executorch/docs/fundamentals/downloading-models).
|
| 49 |
+
|
| 50 |
+
To load these files in your own ExecuTorch runtime, read the
|
| 51 |
+
[compatibility note](https://github.com/pytorch/executorch/blob/main/runtime/COMPATIBILITY.md)
|
| 52 |
+
first.
|
| 53 |
+
|
| 54 |
+
## Model details
|
| 55 |
+
|
| 56 |
+
The Higgs Audio v2 tokenizer turns 24 kHz mono audio into 8 codebooks of 1024
|
| 57 |
+
codes at 25 frames per second (960 samples per frame), and back.
|
| 58 |
+
|
| 59 |
+
- **Decoder:** `decode(codes int64[8, T]) -> audio float32[T * 960]`, for T from
|
| 60 |
+
4 to 1024 frames (0.16 to 41 s). Core ML on the CPU and GPU, fp16 compute.
|
| 61 |
+
`fp16` carries the codec's own weights; `int8` carries int8 weights from GPTQ
|
| 62 |
+
and quantization-aware training of the scales, one scale per 8 input channels.
|
| 63 |
+
- **Encoder:** `encode(wav float32[frames, 960]) -> codes int64[8, frames]`, for
|
| 64 |
+
25 to 500 frames (1 to 20 s): the waveform cut to whole frames and reshaped.
|
| 65 |
+
Core ML on the CPU only, fp32 compute, as the encoder's activations need fp32.
|
| 66 |
+
Both variants carry quantization-aware-trained weights: `int8` everywhere,
|
| 67 |
+
`int4` in HuBERT's transformer layers and int8 elsewhere.
|
| 68 |
+
|
| 69 |
+
Measured on an iPhone 17 (iOS 26.6) with React Native ExecuTorch's native
|
| 70 |
+
libraries v0.11.1. Quality is against the fp32 PyTorch codec: the decoder's
|
| 71 |
+
waveform SNR on 14 test clips, the encoder's share of equal codes (codebook 0 /
|
| 72 |
+
1 / 2-7) on 57 test clips in 7 languages.
|
| 73 |
+
|
| 74 |
+
| File | Time | Peak memory | Quality vs fp32 |
|
| 75 |
+
| --- | --- | --- | --- |
|
| 76 |
+
| decoder fp16 | 53 / 107 ms per 5 / 10 s | ~200 MB at 10 s | 54.8 dB |
|
| 77 |
+
| decoder int8 | 53 / 109 ms per 5 / 10 s | ~690 MB at 10 s | 44.2 dB |
|
| 78 |
+
| encoder int8 | 0.38 / 0.84 / 1.97 s per 5 / 10 / 20 s | 420 / 829 MB at 10 / 20 s | 99.51 / 99.10 / 96.63% |
|
| 79 |
+
| encoder int4 | 0.32 / 0.75 / 1.86 s per 5 / 10 / 20 s | 420 / 860 MB at 10 / 20 s | 99.07 / 98.31 / 94.57% |
|
| 80 |
+
|
| 81 |
+
The decoder's int8 file is half the size of fp16 but takes more memory once
|
| 82 |
+
loaded, as Core ML expands its weights on the GPU. The encoder runs on the CPU
|
| 83 |
+
for the same reason: on the GPU, Core ML holds 1.4 to 2.6 GB of expanded fp32
|
| 84 |
+
weights, while on the CPU it maps them from the file.
|
config.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"modelName": "higgs-audio-v2-tokenizer"
|
| 3 |
+
}
|
coreml/decoder/fp16/codec_decoder_coreml_fp16.pte
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:20bcd5bfbc873ebf54aa1e64194ff4605ca8fb2493963ac1f2054c771bd9af8b
|
| 3 |
+
size 43553653
|
coreml/decoder/int8/codec_decoder_coreml_int8.pte
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9cb8a0ec7d2a89eb91a553a1c33b69092182c2fd43f09de148a24ad4b17c1099
|
| 3 |
+
size 23296289
|
coreml/encoder/int4/codec_encoder_coreml_int4.pte
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:353645efe416edb8a1843be0b76e1734942075957307f044b1d839f183e761ce
|
| 3 |
+
size 135788813
|
coreml/encoder/int8/codec_encoder_coreml_int8.pte
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a8aa635aecd9609aabfbf45d0d36f1c6999f2a240d863250d2450a9c3d193cd8
|
| 3 |
+
size 175933783
|