StemSplit commited on
Commit
98ff3f3
·
verified ·
1 Parent(s): 9cae283

docs: add fp16-weights compact-storage variant section

Browse files
Files changed (1) hide show
  1. README.md +41 -0
README.md CHANGED
@@ -214,6 +214,46 @@ Or use the no-code tools that ship the same model family:
214
 
215
  ---
216
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
217
  ## Files in this repo
218
 
219
  | File | Size | Purpose |
@@ -222,6 +262,7 @@ Or use the no-code tools that ship the same model family:
222
  | `infer.py` | ~6 KB | Pure numpy + onnxruntime reference. No torch. |
223
  | `requirements.txt` | <1 KB | `onnxruntime`, `numpy`, `soundfile`. |
224
  | `README.md` | this file | |
 
225
 
226
  ---
227
 
 
214
 
215
  ---
216
 
217
+ ## Compact storage variant (fp16 weights)
218
+
219
+ Alongside the 316 MB fp32 file, this repo now ships a **165 MB**
220
+ compact-storage variant: `htdemucs_ft_vocals_fp16weights.onnx`.
221
+
222
+ | Variant | File | Disk size | Runtime memory | Latency | Max abs diff vs fp32 |
223
+ |---|---|---:|---:|---:|---:|
224
+ | fp32 (baseline) | `htdemucs_ft_vocals.onnx` | 316 MB | 316 MB | 1.00× | 0 |
225
+ | **fp16 weights** | `htdemucs_ft_vocals_fp16weights.onnx` | **165 MB** | 316 MB | ~1.00× | **6.0e-6** |
226
+
227
+ **How it works.** Large fp32 weight tensors (Conv kernels, attention
228
+ projection matrices, and the four STFT/iSTFT basis Constants — 134 MB
229
+ combined) are stored on disk as fp16. A `Cast(fp16 → fp32)` op is inserted
230
+ in front of each consumer. `onnxruntime` folds those Casts at session-init,
231
+ so the in-memory representation and the compute graph remain pure fp32.
232
+
233
+ **What that buys you.**
234
+ - **1.91× smaller download / app bundle / Docker layer.**
235
+ - Same numerical output as the fp32 file to within fp16 weight-quantization
236
+ noise (max diff 6.0e-6, ~3 decimal digits — below the perceptual
237
+ floor for audio).
238
+ - Identical latency once the session is initialized.
239
+ - Drop-in replacement: every code snippet on this page works unchanged.
240
+ Just point at `htdemucs_ft_vocals_fp16weights.onnx` instead.
241
+
242
+ **When to use which.**
243
+ - Use the **fp32** file when you want bit-exact reproduction of the
244
+ PyTorch reference, e.g. for research or for adding it to an evaluation
245
+ pipeline.
246
+ - Use the **fp16-weights** file for every app bundle, container image,
247
+ CDN download, or mobile deployment. There is no runtime trade-off.
248
+
249
+ > Looking for INT8 quantization or a true compute-fp16 build? We tried
250
+ > both — htdemucs' transformer cross-attention overflows fp16
251
+ > (`Pow(QK²)` past 65,504), and dynamic-INT8 either gave no speedup
252
+ > (MatMul-only) or broke the model (with Conv). The honest answer is that
253
+ > proper INT8 needs static quantization with MUSDB18 calibration data
254
+ > plus model surgery on the STFT layer — a 2-3 day project that's still
255
+ > on the Day 3 roadmap.
256
+
257
  ## Files in this repo
258
 
259
  | File | Size | Purpose |
 
262
  | `infer.py` | ~6 KB | Pure numpy + onnxruntime reference. No torch. |
263
  | `requirements.txt` | <1 KB | `onnxruntime`, `numpy`, `soundfile`. |
264
  | `README.md` | this file | |
265
+ | `htdemucs_ft_vocals_fp16weights.onnx` | 165 MB | Compact-storage variant: same model as `htdemucs_ft_vocals.onnx`, fp16 weights on disk, fp32 compute at runtime. Drop-in replacement. |
266
 
267
  ---
268