Add model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
library_name: coreml
|
| 4 |
+
pipeline_tag: audio-to-audio
|
| 5 |
+
tags:
|
| 6 |
+
- coreml
|
| 7 |
+
- core-ml
|
| 8 |
+
- ios
|
| 9 |
+
- macos
|
| 10 |
+
- apple
|
| 11 |
+
- on-device
|
| 12 |
+
- source-separation
|
| 13 |
+
- stem-separation
|
| 14 |
+
- music
|
| 15 |
+
- arxiv:2211.08553
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# HTDemucs — Core ML
|
| 19 |
+
|
| 20 |
+
*Audio Source Separation*
|
| 21 |
+
|
| 22 |
+
Split music into 4 stems: drums, bass, vocals, other. 44.1 kHz stereo, FP32.
|
| 23 |
+
|
| 24 |
+
Core ML conversion of [adefossez/demucs](https://github.com/adefossez/demucs) for on-device inference on iPhone, iPad and Mac. Converted with `coremltools`; the packages are stateless, so all sequencing and buffering lives in your Swift code.
|
| 25 |
+
|
| 26 |
+
| | |
|
| 27 |
+
|---|---|
|
| 28 |
+
| Task | audio to audio |
|
| 29 |
+
| Upstream | [adefossez/demucs](https://github.com/adefossez/demucs) |
|
| 30 |
+
| Packages | 1 |
|
| 31 |
+
| Download size | 75 MB |
|
| 32 |
+
| Minimum iOS | 17.0 |
|
| 33 |
+
| Peak RAM | ~1000 MB |
|
| 34 |
+
|
| 35 |
+
## Files
|
| 36 |
+
|
| 37 |
+
| File | Size | Compute units | SHA-256 |
|
| 38 |
+
|---|---:|---|---|
|
| 39 |
+
| `HTDemucs_SourceSeparation_F32.mlpackage.zip` | 75 MB | `cpuOnly` | `0fbb941e15a5b2fa…` |
|
| 40 |
+
| **Total** | **75 MB** | | |
|
| 41 |
+
|
| 42 |
+
`compute_units` is not a suggestion -- it is the configuration the conversion was verified against. Moving a package to a different compute unit can silently change the numerics (FP16 attention overflow) or crash on the GPU.
|
| 43 |
+
|
| 44 |
+
## Download
|
| 45 |
+
|
| 46 |
+
```bash
|
| 47 |
+
hf download mlboydaisuke/coreml-zoo --include "demucs/*" --local-dir ./demucs
|
| 48 |
+
unzip './demucs/demucs/*.zip' -d ./demucs
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
## Use in Swift
|
| 52 |
+
|
| 53 |
+
```swift
|
| 54 |
+
import CoreML
|
| 55 |
+
|
| 56 |
+
let config = MLModelConfiguration()
|
| 57 |
+
config.computeUnits = .cpuOnly // as converted — see the table above
|
| 58 |
+
|
| 59 |
+
// Unzip the .mlpackage, drop it into your Xcode target and Xcode compiles it
|
| 60 |
+
// at build time:
|
| 61 |
+
let model = try HTDemucs_SourceSeparation_F32(configuration: config)
|
| 62 |
+
|
| 63 |
+
// ...or compile a downloaded .mlpackage at runtime:
|
| 64 |
+
let compiled = try await MLModel.compileModel(at: mlpackageURL)
|
| 65 |
+
let model = try MLModel(contentsOf: compiled, configuration: config)
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
## Demo
|
| 69 |
+
|
| 70 |
+
- **Sample app** — [`sample_apps/DemucsDemo`](https://github.com/john-rocky/CoreML-Models/tree/master/sample_apps/DemucsDemo), a standalone SwiftUI project.
|
| 71 |
+
- **Models Zoo** — this model is downloadable and runnable inside the [Models Zoo app](https://apps.apple.com/app/id6762083207) on the App Store, no build required.
|
| 72 |
+
|
| 73 |
+
## Conversion
|
| 74 |
+
|
| 75 |
+
- Script: [`convert_htdemucs.py`](https://github.com/john-rocky/CoreML-Models/blob/master/conversion_scripts/convert_htdemucs.py)
|
| 76 |
+
- Pitfalls hit during conversion (FP16 overflow, ANE buffer limits, stride handling): [`docs/coreml_conversion_notes.md`](https://github.com/john-rocky/CoreML-Models/blob/master/docs/coreml_conversion_notes.md)
|
| 77 |
+
- Model index: [CoreML-Models](https://github.com/john-rocky/CoreML-Models)
|
| 78 |
+
|
| 79 |
+
## License
|
| 80 |
+
|
| 81 |
+
The conversion inherits the upstream license: **MIT**.
|
| 82 |
+
|
| 83 |
+
## Credits
|
| 84 |
+
|
| 85 |
+
- Upstream authors: [adefossez/demucs](https://github.com/adefossez/demucs), 2021
|
| 86 |
+
- Core ML conversion: john-rocky (Daisuke Majima)
|