mlboydaisuke commited on
Commit
caeef90
·
verified ·
1 Parent(s): 1e71736

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +61 -0
README.md ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-4.0
3
+ base_model: kyutai/mimi
4
+ tags:
5
+ - litert
6
+ - on-device
7
+ - neural-codec
8
+ - audio
9
+ library_name: litert
10
+ ---
11
+
12
+ # Mimi (Kyutai 2024) — LiteRT on-device (hybrid GPU/CPU)
13
+
14
+ On-device [LiteRT](https://ai.google.dev/edge/litert) conversion of [**kyutai/mimi**](https://huggingface.co/kyutai/mimi),
15
+ the Kyutai/Moshi streaming neural audio codec (24 kHz, 12.5 Hz frame rate). The heavy SEANet
16
+ convolutional halves run on the **CompiledModel GPU** (ML Drift / `LITERT_CL`); the two 8-layer
17
+ Transformers and the split RVQ run on **CPU**. Device-verified on a Pixel 8a (Tensor G3): full
18
+ round-trip at **RTF ≈ 0.35** (faster than real-time), reconstruction at the codec's quality floor.
19
+
20
+ ## Files
21
+
22
+ | File | Size | Placement | Input → Output |
23
+ |------|------|-----------|----------------|
24
+ | `mimi_enc_conv_fp16.tflite` | 24 MB | GPU | audio `[1,1,L]` → feat `[1,512,Se]` |
25
+ | `mimi_enc_tx_fp16.tflite` | 50 MB | CPU | feat `[1,Se,512]` → emb `[1,512,Tc]` |
26
+ | `mimi_dec_tx_fp16.tflite` | 48 MB | CPU | emb `[1,512,Tc]` → conv_in `[1,512,seq]` |
27
+ | `mimi_deconly_fp16.tflite` | 28 MB | GPU | conv_in `[1,512,seq]` → audio `[1,1,L]` |
28
+ | `mimi_rvq.bin` | 69 MB | CPU | codes ↔ emb (32 codebooks, float32 LE) |
29
+
30
+ Graphs are fixed-length (built per duration). The example set is for a 2 s clip (Se=50, Tc=25, seq=50).
31
+
32
+ ## Pipeline
33
+
34
+ ```
35
+ audio →[GPU enc_conv]→ feat →[CPU enc_tx]→ emb →[CPU RVQ.encode]→ codes
36
+ →[CPU RVQ.decode]→ emb →[CPU dec_tx]→ conv_in →[GPU deconly]→ audio
37
+ ```
38
+
39
+ ## Why hybrid
40
+
41
+ Every op in all four graphs is GPU-clean (re-authored), and the convs are **fp16-exact on Mali**
42
+ (decoder-only fed the exact transformer output = 48 dB SNR). But the decoder transformer's residual
43
+ stream reaches **|x|=27**, where the Mali GPU delegate's internal fp16 compute loses precision —
44
+ full-GPU decode drops to ~12 dB on real speech. The transformer behaves **identically standalone and
45
+ fused** on device, so this is fp16 *precision*, not a fusion collapse. The transformers are tiny
46
+ (8 layers × 512, seq ~50), so CPU is trivial and exact; the heavy SEANet convs stay on GPU. The split
47
+ RVQ (1 semantic + 31 acoustic, Euclidean argmin + int64 indices) runs on CPU.
48
+
49
+ ## Re-authoring (litert-torch, parity ~1.0)
50
+
51
+ tanh-GELU · baked RoPE cos/sin + rotate_half · baked causal additive bias · `MimiLayerScale`→Linear ·
52
+ grouped `ZeroStuffConvT1d` (depthwise upsample, no `TRANSPOSE_CONV`) · baked constant conv pad ·
53
+ `nn.ELU`→`relu(x)−relu(1−exp(min(x,0)))` · replicate-pad→SLICE+CONCAT.
54
+
55
+ ## Usage
56
+
57
+ Sample app + conversion scripts: [**LiteRT-Models / mimi**](https://github.com/john-rocky/LiteRT-Models/tree/main/mimi).
58
+ Push the files to the app's `filesDir` with `mimi/scripts/install_to_device.sh`.
59
+
60
+ This conversion uses model-op rewrites + a GPU/CPU placement split, so it is hosted in a personal
61
+ namespace (not a patch-free "clean" sample). License follows upstream Mimi (CC-BY-4.0).