Mirror of mlboydaisuke/Stable-Audio-Open-Small-CoreAI
Browse files- .gitattributes +4 -0
- README.md +118 -0
- demo.gif +3 -0
- macos/metadata.json +13 -0
- macos/sa_cond_fp16b.aimodel/main.hash +1 -0
- macos/sa_cond_fp16b.aimodel/main.mlirb +3 -0
- macos/sa_cond_fp16b.aimodel/metadata.json +3 -0
- macos/sa_dit_fp16.aimodel/main.hash +1 -0
- macos/sa_dit_fp16.aimodel/main.mlirb +3 -0
- macos/sa_dit_fp16.aimodel/metadata.json +3 -0
- macos/sa_vae_fp16.aimodel/main.hash +1 -0
- macos/sa_vae_fp16.aimodel/main.mlirb +3 -0
- macos/sa_vae_fp16.aimodel/metadata.json +3 -0
- macos/t5_tokenizer/tokenizer.json +0 -0
- macos/t5_tokenizer/tokenizer_config.json +1 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,7 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
macos/sa_cond_fp16b.aimodel/main.mlirb filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
macos/sa_dit_fp16.aimodel/main.mlirb filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
macos/sa_vae_fp16.aimodel/main.mlirb filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
demo.gif filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
license_name: stability-ai-community
|
| 4 |
+
license_link: https://huggingface.co/stabilityai/stable-audio-open-small/blob/main/LICENSE.md
|
| 5 |
+
tags:
|
| 6 |
+
- core-ai
|
| 7 |
+
- apple
|
| 8 |
+
- on-device
|
| 9 |
+
- text-to-audio
|
| 10 |
+
- music-generation
|
| 11 |
+
- stable-audio
|
| 12 |
+
- diffusion
|
| 13 |
+
base_model:
|
| 14 |
+
- stabilityai/stable-audio-open-small
|
| 15 |
+
pipeline_tag: text-to-audio
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
> **Mirror** of [`mlboydaisuke/Stable-Audio-Open-Small-CoreAI`](https://huggingface.co/mlboydaisuke/Stable-Audio-Open-Small-CoreAI) — the canonical repo ([CoreAI Model Zoo](https://github.com/john-rocky/coreai-model-zoo)). Updates land there first.
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
# Stable Audio Open Small — Core AI (on-device music generation)
|
| 22 |
+
|
| 23 |
+
**The model zoo's first MUSIC / AUDIO generation model for Apple Core AI.** Type a prompt, get ~11s
|
| 24 |
+
of 44.1 kHz stereo audio — generated entirely **on-device** on Apple Silicon. A community port of
|
| 25 |
+
[`stabilityai/stable-audio-open-small`](https://huggingface.co/stabilityai/stable-audio-open-small)
|
| 26 |
+
(Stability AI + Arm) to Core AI.
|
| 27 |
+
|
| 28 |
+
A latent **diffusion** text-to-audio model: a T5 text encoder conditions a DiT (diffusion transformer)
|
| 29 |
+
that denoises a latent over **8 rectified-flow steps**, then an Oobleck VAE decodes the latent to a
|
| 30 |
+
waveform. Distilled (ARC) for few-step generation, so it's fast.
|
| 31 |
+
|
| 32 |
+
<!-- gen-cards:use-it begin id=stable-audio-open-small (managed by scripts/gen-cards — edit cards.json / QuickStart.swift, not this block) -->
|
| 33 |
+

|
| 34 |
+
*Stable Audio Open Small on iPhone 17 Pro — the zoo's coreai-audio app, 12 s of audio in ~1 s.*
|
| 35 |
+
|
| 36 |
+
## Use it
|
| 37 |
+
|
| 38 |
+
▶️ **Run it (source)** — the [Music runner](https://github.com/john-rocky/coreai-kit/tree/main/Examples/Music)
|
| 39 |
+
(GUI + CLI, one app for every text-to-music model in the catalog):
|
| 40 |
+
|
| 41 |
+
```bash
|
| 42 |
+
git clone https://github.com/john-rocky/coreai-kit
|
| 43 |
+
open coreai-kit/Examples/Music/Music.xcodeproj
|
| 44 |
+
# → Run, then pick "Stable Audio Open Small" in the model picker
|
| 45 |
+
|
| 46 |
+
# agents / headless (macOS):
|
| 47 |
+
cd coreai-kit/Examples/Music
|
| 48 |
+
swift run music-cli --model stable-audio-open-small --prompt "128 BPM tech house drum loop" --output loop.wav
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
💻 **Build with it** — complete; the glue is kit API, copy-paste runs:
|
| 52 |
+
|
| 53 |
+
```swift
|
| 54 |
+
import CoreAIKit
|
| 55 |
+
|
| 56 |
+
let musician = try await KitMusician(catalog: "stable-audio-open-small")
|
| 57 |
+
let audio = try await musician.generate(prompt)
|
| 58 |
+
// audio.samples: 44.1 kHz stereo (planar L/R) — play it or write a WAV
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
The take-home is [`Examples/Music/Sources/QuickStart.swift`](https://github.com/john-rocky/coreai-kit/blob/main/Examples/Music/Sources/QuickStart.swift)
|
| 62 |
+
— this exact code as one typed function, no UI; the CLI is an argument shell over it, and
|
| 63 |
+
the GUI drives the same `KitMusician(catalog:)` and plays the result.
|
| 64 |
+
Length? `generate(_:seconds:)` up to the model's ~11 s window. The WAV container is your
|
| 65 |
+
app's territory (the runner ships a 30-line writer with planar-stereo support).
|
| 66 |
+
|
| 67 |
+
**Integration checklist**
|
| 68 |
+
|
| 69 |
+
- SPM: `https://github.com/john-rocky/coreai-kit` → product **CoreAIKit**
|
| 70 |
+
- Info.plist: none needed
|
| 71 |
+
- Entitlements: none needed (macOS)
|
| 72 |
+
- First run downloads the model — 1.1 GB (Mac) — then it loads from the
|
| 73 |
+
local cache (Application Support; progress via the `downloadProgress` callback)
|
| 74 |
+
- Measure in Release — Debug is ~3× slower on per-token host work
|
| 75 |
+
<!-- gen-cards:use-it end -->
|
| 76 |
+
|
| 77 |
+
## What's in the bundle (`macos/`)
|
| 78 |
+
|
| 79 |
+
Three Core AI `.aimodel` bundles + a tiny host sampler loop:
|
| 80 |
+
|
| 81 |
+
| bundle | role | I/O |
|
| 82 |
+
|---|---|---|
|
| 83 |
+
| `sa_cond_fp16b` | T5-base encoder + number conditioner | `input_ids[1,64], attention_mask[1,64], seconds_norm[1] → cross_attn_cond[1,65,768], global_embed[1,768], cond_mask[1,65]` |
|
| 84 |
+
| `sa_dit_fp16` | diffusion transformer (run 8×) | `x[1,64,256], t[1], cross_attn_cond, global_embed, cross_attn_cond_mask → v[1,64,256]` |
|
| 85 |
+
| `sa_vae_fp16` | Oobleck VAE decoder | `latent[1,64,256] → audio[1,2,524288]` |
|
| 86 |
+
|
| 87 |
+
**Host loop** (`StableAudioRunner`): tokenize (T5, `t5_tokenizer/`) → conditioner → start from Gaussian
|
| 88 |
+
noise → 8-step rectified-flow euler `x = x + (t_next − t)·v` over the fixed schedule
|
| 89 |
+
`[1.0, .9944, .9845, .9579, .8909, .7455, .5125, .2739] → 0` → VAE decode → 44.1 kHz stereo wav.
|
| 90 |
+
No KV cache, no CFG (cfg_scale 1.0 — the model is ARC-distilled).
|
| 91 |
+
|
| 92 |
+
## Performance (M4 Max, GPU)
|
| 93 |
+
|
| 94 |
+
| metric | value |
|
| 95 |
+
|---|---|
|
| 96 |
+
| 8-step DiT | ~200 ms (25 ms/step) |
|
| 97 |
+
| VAE decode | ~185 ms |
|
| 98 |
+
| **total** | **~0.4 s for ~11.9 s of audio (~30× real-time)** |
|
| 99 |
+
| size | fp16, ~1.0 GB (DiT 651M + cond 210M + VAE 149M) |
|
| 100 |
+
|
| 101 |
+
Numerics: each bundle engine-gated vs the reference at cos ≥ 0.9999; full pipeline reproduces the
|
| 102 |
+
reference audio exactly.
|
| 103 |
+
|
| 104 |
+
## Roadmap
|
| 105 |
+
|
| 106 |
+
- iPhone (h18p) build — bundles AOT-compile; device RTF pending
|
| 107 |
+
- int8 (further size cut)
|
| 108 |
+
- a music-generation tab in the zoo app
|
| 109 |
+
|
| 110 |
+
## Credits & license
|
| 111 |
+
|
| 112 |
+
A community **Core AI conversion** — all credit to **Stability AI** (and Arm) for
|
| 113 |
+
[Stable Audio Open Small](https://huggingface.co/stabilityai/stable-audio-open-small); T5 text encoder
|
| 114 |
+
by Google. This bundle is governed by the **[Stability AI Community License](https://huggingface.co/stabilityai/stable-audio-open-small/blob/main/LICENSE.md)**
|
| 115 |
+
(free for non-commercial use and for commercial use under \$1M annual revenue; review the license
|
| 116 |
+
before use). No retraining — conversion only.
|
| 117 |
+
|
| 118 |
+
Part of the [Core AI model zoo](https://github.com/john-rocky/coreai-model-zoo).
|
demo.gif
ADDED
|
Git LFS Details
|
macos/metadata.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"metadata_version": "0.2",
|
| 3 |
+
"kind": "music-gen",
|
| 4 |
+
"name": "Stable Audio Open Small (Core AI)",
|
| 5 |
+
"bundles": { "conditioner": "sa_cond_fp16b.aimodel", "dit": "sa_dit_fp16.aimodel", "vae": "sa_vae_fp16.aimodel" },
|
| 6 |
+
"sampler": { "steps": 8, "objective": "rectified_flow_euler", "cfg_scale": 1.0,
|
| 7 |
+
"t_schedule": [1.0, 0.9943756, 0.9844802, 0.9579123, 0.8909032, 0.7455466, 0.5124974, 0.27388501, 0.0] },
|
| 8 |
+
"audio": { "sample_rate": 44100, "channels": 2, "samples": 524288, "max_seconds": 11 },
|
| 9 |
+
"latent": { "channels": 64, "frames": 256 },
|
| 10 |
+
"conditioning": { "tokenizer": "t5-base", "max_length": 64, "seconds_max": 256 },
|
| 11 |
+
"source": { "base_model": "stabilityai/stable-audio-open-small" },
|
| 12 |
+
"compression": "fp16", "license": "stability-ai-community"
|
| 13 |
+
}
|
macos/sa_cond_fp16b.aimodel/main.hash
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
C��7�U�8i�L�-�Ѽ�M6$2����
|
macos/sa_cond_fp16b.aimodel/main.mlirb
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:43feb5110437c65502f03869d598804c962d99d1bc864d36243284c4040fb0e5
|
| 3 |
+
size 219890015
|
macos/sa_cond_fp16b.aimodel/metadata.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"assetVersion" : "2.0"
|
| 3 |
+
}
|
macos/sa_dit_fp16.aimodel/main.hash
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
�n�a�C�ĕ8�=%wM�k&�m�rJ«
|
macos/sa_dit_fp16.aimodel/main.mlirb
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:89116ed561887f439bc49538c43d25774daa6b26b76d7fe414724ac2ab0d1dda
|
| 3 |
+
size 682114965
|
macos/sa_dit_fp16.aimodel/metadata.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"assetVersion" : "2.0"
|
| 3 |
+
}
|
macos/sa_vae_fp16.aimodel/main.hash
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
R�mW�r`�ᘦ�5���4c"(ž��0�>LE�>
|
macos/sa_vae_fp16.aimodel/main.mlirb
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:52ce6d578f726099e198a6a135ace9b7f334632228c5bec4f930883e4c45b23e
|
| 3 |
+
size 156237126
|
macos/sa_vae_fp16.aimodel/metadata.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"assetVersion" : "2.0"
|
| 3 |
+
}
|
macos/t5_tokenizer/tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
macos/t5_tokenizer/tokenizer_config.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"model_type":"t5","tokenizer_class":"T5Tokenizer"}
|