MusicForge commited on
Commit
d1d04ee
·
verified ·
1 Parent(s): 8b2e390

Mirror from aufklarer/Stable-Audio-3-DiT-Medium-MLX-8bit

Browse files
README.md ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ license_name: stability-ai-community-license
4
+ license_link: https://stability.ai/license
5
+ language:
6
+ - en
7
+ tags:
8
+ - mlx
9
+ - audio
10
+ - text-to-audio
11
+ - music
12
+ - sfx
13
+ - latent-diffusion
14
+ - inpainting
15
+ - dit
16
+ - stable-audio-3
17
+ - quantized
18
+ - int8
19
+ base_model: stabilityai/stable-audio-3-optimized
20
+ library_name: mlx
21
+ pipeline_tag: text-to-audio
22
+ ---
23
+
24
+ # Stable-Audio-3-DiT-Medium-MLX-8bit
25
+
26
+ - [speech-swift](https://github.com/soniqo/speech-swift) — Apple SDK
27
+ - [soniqo.audio](https://soniqo.audio) — website
28
+ - [blog](https://soniqo.audio/blog) — blog
29
+
30
+ MLX port of [Stability AI Stable Audio 3 (optimized)](https://huggingface.co/stabilityai/stable-audio-3-optimized).
31
+ Latent-diffusion text-to-audio with **mask-based inpainting** and continuation, with the DiT denoiser quantized to **INT8** for Apple Silicon.
32
+
33
+ ## What's in this bundle
34
+
35
+ | Component | Format | Notes |
36
+ |---|---|---|
37
+ | DiT (Medium, 1.4B) | **INT8** | Diffusion Transformer denoiser, group-size 64 |
38
+ | SAME-L encoder | FP32 | Audio → latents (codec is precision-sensitive — differential attention cancels in FP16) |
39
+ | SAME-L decoder | FP32 | Latents → 44.1 kHz stereo waveform |
40
+ | T5Gemma text encoder | FP16 | Prompt conditioning |
41
+
42
+ Codec stays FP32 because the SAME differential attention catastrophically cancels in FP16 (per Stability's own MLX runtime). T5Gemma stays FP16 — it's small relative to the DiT and quantization gives no speed-up on the short prompt encode pass.
43
+
44
+ ## Files
45
+
46
+ | File | Size | Format |
47
+ |---|---|---|
48
+ | `dit_medium/model.safetensors` | 1 GB | int8 |
49
+ | `same_l_encoder/model.safetensors` | 2 GB | fp32 |
50
+ | `same_l_decoder/model.safetensors` | 2 GB | fp32 |
51
+ | `t5gemma/model.safetensors` | 541 MB | fp16 |
52
+
53
+ ## Capabilities
54
+
55
+ - **Text-to-audio** generation (music + SFX depending on DiT specialisation)
56
+ - **Inpainting / region editing** via masked latent diffusion
57
+ - **Audio continuation** from a short prompt clip
58
+ - **Variable-length** generation up to several minutes
59
+
60
+ The `DiT-Small-Music-*` variant is music-specialised; `DiT-Small-SFX-*` is sound-effects specialised; `DiT-Medium-*` is the higher-quality general model.
61
+
62
+ ## Usage
63
+
64
+ This bundle is the quantized weights only — inference uses Stability AI's official pure-MLX runtime at [`stable-audio-3/optimized/mlx`](https://github.com/Stability-AI/stable-audio-3/tree/main/optimized/mlx). At load time, each `(base.weight, base.scales, base.biases)` triplet is dequantized via `mlx.core.dequantize` back to FP16; codec and T5Gemma load as-is.
65
+
66
+ ```python
67
+ from huggingface_hub import snapshot_download
68
+ import mlx.core as mx
69
+
70
+ bundle = snapshot_download("aufklarer/Stable-Audio-3-DiT-Medium-MLX-8bit")
71
+
72
+ def load_component(comp_dir):
73
+ w = dict(mx.load(f"{comp_dir}/model.safetensors"))
74
+ bases = {k[:-7] for k in w if k.endswith(".scales")
75
+ if f"{k[:-7]}.weight" in w and f"{k[:-7]}.biases" in w}
76
+ out = {}
77
+ for k, v in w.items():
78
+ if k.endswith((".scales", ".biases")) and k.rsplit(".", 1)[0] in bases:
79
+ continue
80
+ if k.endswith(".weight") and k[:-7] in bases:
81
+ base = k[:-7]
82
+ out[k] = mx.dequantize(w[f"{base}.weight"], w[f"{base}.scales"],
83
+ w[f"{base}.biases"], group_size=64, bits=8)
84
+ else:
85
+ out[k] = v
86
+ return out
87
+ ```
88
+
89
+ Plug the rehydrated dict into the matching model class from `stable-audio-3/optimized/mlx/models/defs/`.
90
+
91
+ ## Source
92
+
93
+ - Upstream weights: [stabilityai/stable-audio-3-optimized](https://huggingface.co/stabilityai/stable-audio-3-optimized) (Stability AI Community License)
94
+ - Text encoder lineage: [google/t5gemma-b-b-ul2](https://huggingface.co/google/t5gemma-b-b-ul2) (Gemma Terms of Use)
95
+ - Paper: [Stable Audio 3 — Stability AI](https://arxiv.org/abs/2605.17991)
96
+
97
+ ## License
98
+
99
+ **Stability AI Community License** — free for non-commercial research and for commercial use up to the revenue threshold defined by Stability AI; see the [license text](https://stability.ai/license). T5Gemma component additionally inherits the **Gemma Terms of Use**.
config.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "model_type": "stable_audio_dit"
3
+ }
dit_medium/manifest.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "source_npz": "dit_medium_f16.npz",
3
+ "format": "int8",
4
+ "group_size": 64,
5
+ "stats": {
6
+ "quantized": 202,
7
+ "float": 323,
8
+ "skipped_shape": 0,
9
+ "by_rank": {
10
+ "1": 295,
11
+ "2": 228,
12
+ "3": 2
13
+ },
14
+ "size_in": 2907132960,
15
+ "size_out": 1555714112,
16
+ "bits": 8,
17
+ "group_size": 64
18
+ },
19
+ "size_bytes": 1555822118,
20
+ "sha256": "0d145d800c28e7ac68208375b9ae5ab923ade7ffc00588d30566e2fbc80b94fc"
21
+ }
dit_medium/model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0d145d800c28e7ac68208375b9ae5ab923ade7ffc00588d30566e2fbc80b94fc
3
+ size 1555822118
manifest.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bundle": "Stable-Audio-3-DiT-Medium-MLX-8bit",
3
+ "components": {
4
+ "dit_medium": {
5
+ "format": "int8",
6
+ "size_bytes": 1555822118,
7
+ "sha256": "0d145d800c28e7ac68208375b9ae5ab923ade7ffc00588d30566e2fbc80b94fc"
8
+ },
9
+ "same_l_encoder": {
10
+ "format": "fp32",
11
+ "size_bytes": 1704272119,
12
+ "sha256": "9f1ba713acf75034216cfbdd5f765edca81fcaaf7719231922cbd14cb7852680"
13
+ },
14
+ "same_l_decoder": {
15
+ "format": "fp32",
16
+ "size_bytes": 1704270957,
17
+ "sha256": "685bf46f7d3f7b2d10ff8d48e5757fb8da80dbc3912e4ddc8f415ca559be7679"
18
+ },
19
+ "t5gemma": {
20
+ "format": "fp16",
21
+ "size_bytes": 567416487,
22
+ "sha256": "3c6ba187587a2a124ba4224fdc3dea85e6dfae33745fc5b735326f80e2c31dff"
23
+ }
24
+ }
25
+ }
same_l_decoder/manifest.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "source_npz": "same_l_decoder_f32.npz",
3
+ "format": "fp32",
4
+ "group_size": null,
5
+ "stats": {
6
+ "quantized": 0,
7
+ "float": 222,
8
+ "skipped_shape": 0,
9
+ "by_rank": {
10
+ "1": 171,
11
+ "2": 49,
12
+ "3": 2
13
+ },
14
+ "size_in": 1704249540,
15
+ "size_out": 1704249540,
16
+ "bits": -1,
17
+ "group_size": 64
18
+ },
19
+ "size_bytes": 1704270957,
20
+ "sha256": "685bf46f7d3f7b2d10ff8d48e5757fb8da80dbc3912e4ddc8f415ca559be7679"
21
+ }
same_l_decoder/model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:685bf46f7d3f7b2d10ff8d48e5757fb8da80dbc3912e4ddc8f415ca559be7679
3
+ size 1704270957
same_l_encoder/manifest.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "source_npz": "same_l_encoder_f32.npz",
3
+ "format": "fp32",
4
+ "group_size": null,
5
+ "stats": {
6
+ "quantized": 0,
7
+ "float": 224,
8
+ "skipped_shape": 0,
9
+ "by_rank": {
10
+ "3": 3,
11
+ "1": 171,
12
+ "2": 50
13
+ },
14
+ "size_in": 1704250564,
15
+ "size_out": 1704250564,
16
+ "bits": -1,
17
+ "group_size": 64
18
+ },
19
+ "size_bytes": 1704272119,
20
+ "sha256": "9f1ba713acf75034216cfbdd5f765edca81fcaaf7719231922cbd14cb7852680"
21
+ }
same_l_encoder/model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9f1ba713acf75034216cfbdd5f765edca81fcaaf7719231922cbd14cb7852680
3
+ size 1704272119
t5gemma/manifest.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "source_npz": "t5gemma_f16.npz",
3
+ "format": "fp16",
4
+ "group_size": null,
5
+ "stats": {
6
+ "quantized": 0,
7
+ "float": 137,
8
+ "skipped_shape": 0,
9
+ "by_rank": {
10
+ "1": 52,
11
+ "2": 85
12
+ },
13
+ "size_in": 567402094,
14
+ "size_out": 567402094,
15
+ "bits": -1,
16
+ "group_size": 64
17
+ },
18
+ "size_bytes": 567416487,
19
+ "sha256": "3c6ba187587a2a124ba4224fdc3dea85e6dfae33745fc5b735326f80e2c31dff"
20
+ }
t5gemma/model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3c6ba187587a2a124ba4224fdc3dea85e6dfae33745fc5b735326f80e2c31dff
3
+ size 567416487