Upload folder using huggingface_hub
Browse files- LICENSE.md +31 -0
- README.md +82 -3
LICENSE.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# License
|
| 2 |
+
|
| 3 |
+
This model is derived from [facebookresearch/demucs](https://github.com/facebookresearch/demucs),
|
| 4 |
+
licensed under the MIT License. No training or fine-tuning was performed — this repository
|
| 5 |
+
contains an ONNX format conversion of the original pretrained `htdemucs.th` checkpoint.
|
| 6 |
+
|
| 7 |
+
## MIT License (original demucs project)
|
| 8 |
+
|
| 9 |
+
Copyright (c) Facebook, Inc. and its affiliates.
|
| 10 |
+
|
| 11 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 12 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 13 |
+
in the Software without restriction, including without limitation the rights
|
| 14 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 15 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 16 |
+
furnished to do so, subject to the following conditions:
|
| 17 |
+
|
| 18 |
+
The above copyright notice and this permission notice shall be included in all
|
| 19 |
+
copies or substantial portions of the Software.
|
| 20 |
+
|
| 21 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 22 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 23 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 24 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 25 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 26 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 27 |
+
SOFTWARE.
|
| 28 |
+
|
| 29 |
+
> Note: verify this text against the exact `LICENSE` file in the upstream
|
| 30 |
+
> `facebookresearch/demucs` repository before publishing, and update the copyright
|
| 31 |
+
> line if it differs.
|
README.md
CHANGED
|
@@ -1,3 +1,82 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- onnx
|
| 5 |
+
- webnn
|
| 6 |
+
- audio-source-separation
|
| 7 |
+
- htdemucs
|
| 8 |
+
pipeline_tag: audio-to-audio
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# Stem Separator (HTDemucs v4, fwd-only ONNX export) — WebNN
|
| 12 |
+
|
| 13 |
+
ONNX export of Meta's pretrained **HTDemucs v4** (`htdemucs.th`, base/non-fine-tuned checkpoint)
|
| 14 |
+
used by the [WebNN Developer Preview](https://github.com/microsoft/webnn-developer-preview) Stem
|
| 15 |
+
Separator demo. Splits a stereo mix into **drums / bass / other / vocals**, running entirely
|
| 16 |
+
client-side via ONNX Runtime Web with WebNN (NPU/GPU) acceleration, cascading to WebGPU/WASM.
|
| 17 |
+
|
| 18 |
+
## Files
|
| 19 |
+
|
| 20 |
+
| File | Size | Description |
|
| 21 |
+
|---|---|---|
|
| 22 |
+
| `onnx/htdemucs_fwd.onnx` | ~2.3 MB | Model graph |
|
| 23 |
+
| `onnx/htdemucs_fwd.onnx.data` | ~168 MB | External weights |
|
| 24 |
+
|
| 25 |
+
## Provenance
|
| 26 |
+
|
| 27 |
+
- **Source checkpoint**: Meta Research's pretrained `htdemucs.th` base checkpoint (signature
|
| 28 |
+
`955717e8`, filename `955717e8-8726e21a.th`) from the
|
| 29 |
+
[facebookresearch/demucs](https://github.com/facebookresearch/demucs) project (MIT license),
|
| 30 |
+
[checkpoint link](https://dl.fbaipublicfiles.com/demucs/hybrid_transformer/955717e8-8726e21a.th).
|
| 31 |
+
No training or fine-tuning was performed — this is a format conversion of an already-trained model.
|
| 32 |
+
- **Conversion**: exported via `convert_htdemucs_fwd_only.py`, a script modeled on the HTDemucs
|
| 33 |
+
conversion utilities from the
|
| 34 |
+
[RyanMetcalfeInt8/Music-Source-Separation-Training](https://github.com/RyanMetcalfeInt8/Music-Source-Separation-Training)
|
| 35 |
+
fork, purpose-built to produce a clean, opset-pinned ONNX file for web/WebNN consumption rather
|
| 36 |
+
than an OpenVINO IR intermediate.
|
| 37 |
+
- **Why fwd-only**: `torch.onnx.export` cannot trace the complex-tensor ops used by HTDemucs's
|
| 38 |
+
STFT/iSTFT stages. Those stages are reimplemented client-side in JavaScript instead, matching the
|
| 39 |
+
original PyTorch implementation within floating-point tolerance.
|
| 40 |
+
- **Conversion command**:
|
| 41 |
+
```
|
| 42 |
+
python convert_htdemucs_fwd_only.py \
|
| 43 |
+
--config configs/config_musdb18_htdemucs.yaml \
|
| 44 |
+
--checkpoint 955717e8-8726e21a.th \
|
| 45 |
+
--output htdemucs_fwd.onnx
|
| 46 |
+
```
|
| 47 |
+
The exact script used is included in this repository at
|
| 48 |
+
[`tools/convert_htdemucs_fwd_only.py`](./tools/convert_htdemucs_fwd_only.py) as reproducibility
|
| 49 |
+
collateral (adapted from the fork above, MIT License).
|
| 50 |
+
|
| 51 |
+
## Input / Output shapes
|
| 52 |
+
|
| 53 |
+
| Tensor | Shape | Description |
|
| 54 |
+
|---|---|---|
|
| 55 |
+
| `x` (input) | `[1, 4, 2048, 336]` | Normalized CAC spectrogram (freq-domain branch) |
|
| 56 |
+
| `xt` (input) | `[1, 2, 343980]` | Normalized stereo waveform (time-domain branch), ~7.8s @ 44.1kHz |
|
| 57 |
+
| `x_out` (output) | `[1, 16, 2048, 336]` | 4 stems × 4-channel CAC spectrogram |
|
| 58 |
+
| `xt_out` (output) | `[1, 8, 343980]` | 4 stems × stereo waveform |
|
| 59 |
+
|
| 60 |
+
Segments are processed with 50% overlap (`SEGMENT_LENGTH=343980`, `OVERLAP=171990`) and
|
| 61 |
+
reassembled with triangular-weighted overlap-add.
|
| 62 |
+
|
| 63 |
+
## Validation
|
| 64 |
+
|
| 65 |
+
Compared against a Python fp32 reference pipeline (sine-wave input, every intermediate stage dumped):
|
| 66 |
+
|
| 67 |
+
| Stage | Max diff |
|
| 68 |
+
|---|---|
|
| 69 |
+
| STFT | 9.5e-7 |
|
| 70 |
+
| pre_forward | 7.6e-6 |
|
| 71 |
+
| ONNX `fwd` (fp16) | MAE 9e-4 |
|
| 72 |
+
| post_forward | 1.8e-7 |
|
| 73 |
+
|
| 74 |
+
## Usage
|
| 75 |
+
|
| 76 |
+
See the [Stem Separator demo](https://github.com/microsoft/webnn-developer-preview/tree/main/demos/stem-separator)
|
| 77 |
+
in the WebNN Developer Preview repository for the full client-side pre/post-processing pipeline.
|
| 78 |
+
|
| 79 |
+
## License
|
| 80 |
+
|
| 81 |
+
MIT - see [LICENSE.md](./LICENSE.md). Derived from
|
| 82 |
+
[facebookresearch/demucs](https://github.com/facebookresearch/demucs) (MIT).
|