Add model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
license_name: stability-ai-community
|
| 4 |
+
license_link: https://huggingface.co/stabilityai/stable-audio-open-small
|
| 5 |
+
library_name: coreml
|
| 6 |
+
pipeline_tag: text-to-audio
|
| 7 |
+
base_model: stabilityai/stable-audio-open-small
|
| 8 |
+
base_model_relation: quantized
|
| 9 |
+
tags:
|
| 10 |
+
- coreml
|
| 11 |
+
- core-ml
|
| 12 |
+
- ios
|
| 13 |
+
- macos
|
| 14 |
+
- apple
|
| 15 |
+
- on-device
|
| 16 |
+
- text-to-audio
|
| 17 |
+
- music-generation
|
| 18 |
+
- dit
|
| 19 |
+
- arxiv:2505.08175
|
| 20 |
+
---
|
| 21 |
+
|
| 22 |
+
# Stable Audio Open — Core ML
|
| 23 |
+
|
| 24 |
+
*Text-to-Music, 2024*
|
| 25 |
+
|
| 26 |
+
Text-to-music. Up to 11.9s stereo 44.1 kHz. Rectified flow DiT + T5 + Oobleck VAE.
|
| 27 |
+
|
| 28 |
+
Core ML conversion of [stabilityai/stable-audio-open-small](https://huggingface.co/stabilityai/stable-audio-open-small) 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.
|
| 29 |
+
|
| 30 |
+
| | |
|
| 31 |
+
|---|---|
|
| 32 |
+
| Task | text to audio |
|
| 33 |
+
| Upstream | [stabilityai/stable-audio-open-small](https://huggingface.co/stabilityai/stable-audio-open-small) |
|
| 34 |
+
| Packages | 4 |
|
| 35 |
+
| Download size | 1.41 GB |
|
| 36 |
+
| Minimum iOS | 17.0 |
|
| 37 |
+
| Peak RAM | ~1200 MB |
|
| 38 |
+
|
| 39 |
+
## Files
|
| 40 |
+
|
| 41 |
+
| File | Size | Compute units | SHA-256 |
|
| 42 |
+
|---|---:|---|---|
|
| 43 |
+
| `StableAudioT5Encoder.mlpackage.zip` | 94 MB | `cpuAndGPU` | `319a8ba775d30924…` |
|
| 44 |
+
| `StableAudioNumberEmbedder.mlpackage.zip` | 367 KB | `cpuAndGPU` | `04bdc5de00a2cf1c…` |
|
| 45 |
+
| `StableAudioDiT.mlpackage.zip` | 1.18 GB | `cpuOnly` | `b17da4fc4df85782…` |
|
| 46 |
+
| `StableAudioVAEDecoder.mlpackage.zip` | 138 MB | `cpuAndGPU` | `7207544cca9799cc…` |
|
| 47 |
+
| `t5_vocab.json` | 732 KB | `-` | `7c9ff3ac1b3dbcaa…` |
|
| 48 |
+
| **Total** | **1.41 GB** | | |
|
| 49 |
+
|
| 50 |
+
`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.
|
| 51 |
+
|
| 52 |
+
## Download
|
| 53 |
+
|
| 54 |
+
```bash
|
| 55 |
+
hf download mlboydaisuke/coreml-zoo --include "stableaudio/*" --local-dir ./stable_audio
|
| 56 |
+
unzip './stable_audio/stableaudio/*.zip' -d ./stable_audio
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
## Use in Swift
|
| 60 |
+
|
| 61 |
+
```swift
|
| 62 |
+
import CoreML
|
| 63 |
+
|
| 64 |
+
let config = MLModelConfiguration()
|
| 65 |
+
config.computeUnits = .cpuAndGPU // as converted — see the table above
|
| 66 |
+
|
| 67 |
+
// Unzip the .mlpackage, drop it into your Xcode target and Xcode compiles it
|
| 68 |
+
// at build time:
|
| 69 |
+
let model = try StableAudioT5Encoder(configuration: config)
|
| 70 |
+
|
| 71 |
+
// ...or compile a downloaded .mlpackage at runtime:
|
| 72 |
+
let compiled = try await MLModel.compileModel(at: mlpackageURL)
|
| 73 |
+
let model = try MLModel(contentsOf: compiled, configuration: config)
|
| 74 |
+
```
|
| 75 |
+
|
| 76 |
+
> This model is split into 4 Core ML packages that are driven in sequence from Swift. Load them one at a time, copy the outputs out of the `MLMultiArray` buffers and release each model before loading the next — two large Core ML models resident at once will OOM on an iPhone.
|
| 77 |
+
|
| 78 |
+
## Demo
|
| 79 |
+
|
| 80 |
+
- **Sample app** — [`sample_apps/StableAudioDemo`](https://github.com/john-rocky/CoreML-Models/tree/master/sample_apps/StableAudioDemo), a standalone SwiftUI project.
|
| 81 |
+
- **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.
|
| 82 |
+
|
| 83 |
+
## Conversion
|
| 84 |
+
|
| 85 |
+
- Script: [`convert_stable_audio.py`](https://github.com/john-rocky/CoreML-Models/blob/master/conversion_scripts/convert_stable_audio.py)
|
| 86 |
+
- 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)
|
| 87 |
+
- Model index: [CoreML-Models](https://github.com/john-rocky/CoreML-Models)
|
| 88 |
+
|
| 89 |
+
## License
|
| 90 |
+
|
| 91 |
+
The conversion inherits the upstream license: **Stability AI Community License**.
|
| 92 |
+
See [https://huggingface.co/stabilityai/stable-audio-open-small](https://huggingface.co/stabilityai/stable-audio-open-small).
|
| 93 |
+
|
| 94 |
+
> Free for non-commercial and limited commercial use; see the Stability AI Community License.
|
| 95 |
+
|
| 96 |
+
## Credits
|
| 97 |
+
|
| 98 |
+
- Upstream authors: [stabilityai/stable-audio-open-small](https://huggingface.co/stabilityai/stable-audio-open-small), 2024
|
| 99 |
+
- Core ML conversion: john-rocky (Daisuke Majima)
|