ahuzmeza's picture
Add Stable Audio 3 medium
834efd1 verified
|
Raw History Blame Contribute Delete
2.81 kB
---
library_name: mlx-audio
license: other
license_name: stable-audio-community
license_link: LICENSE.md
pipeline_tag: text-to-audio
base_model: stabilityai/stable-audio-3-medium
tags:
- mlx
- mlx-audio
- text-to-audio
- audio-generation
- music
- sound-effects
---
# stable-audio-3-medium
**Powered by Stability AI**
Stable Audio 3 medium in MLX format for [mlx-audio](https://github.com/Blaizzy/mlx-audio). It generates stereo 44.1 kHz music and sound effects from a text prompt, up to 380 seconds: a T5Gemma text encoder, a 24-layer diffusion transformer sampled in 8 ping-pong steps, and the SAME-L decoder. The diffusion transformer is stored in float16, the decoder in float32.
## Use
Stable Audio 3 support in mlx-audio is in review and ships in its next release.
```bash
pip install -U mlx-audio
python -m mlx_audio.music.generate \
--model mlx-community/stable-audio-3-medium \
--caption "Warm lofi hip hop with dusty drums, mellow Rhodes piano and deep bass, 85 BPM" \
--duration 30 \
--seed 11 \
--output lofi.wav
```
```python
from mlx_audio.music import load
model = load("mlx-community/stable-audio-3-medium")
for result in model.generate(
text="Warm lofi hip hop with dusty drums, mellow Rhodes piano and deep bass, 85 BPM",
duration=30,
steps=8,
seed=11,
):
print(result.audio.shape, result.sample_rate)
```
`--cfg-scale` defaults to 1 (guidance off). A larger value enables `--negative-prompt` and doubles the model calls per step.
## Source
Converted from the MLX export in [stabilityai/stable-audio-3-optimized](https://huggingface.co/stabilityai/stable-audio-3-optimized), revision `30cb2644da54bfa63275d1bc7f1fa67fc718680f`, with `model_config.json` and the text encoder from [stabilityai/stable-audio-3-medium-base](https://huggingface.co/stabilityai/stable-audio-3-medium-base). The conversion script, `mlx_audio/music/models/stable_audio_3/convert.py`, comes with medium support in mlx-audio. `config.json` and `model_config.json` are the medium-base model config, from which mlx-audio reads only the model sizes and sample settings. See `NOTICE` for what changed.
## License
The model is licensed under the Stability AI Community License (`LICENSE.md`). If you distribute it or a derivative work, you must provide a copy of that license, keep the attribution in `NOTICE`, and display "Powered by Stability AI". Use is subject to Stability AI's acceptable use policy, and the license sets terms for commercial use.
The T5Gemma text encoder in `t5gemma-b-b-ul2/` is subject to the Gemma Terms of Use (`LICENSE_GEMMA.md`, [ai.google.dev/gemma/terms](https://ai.google.dev/gemma/terms)), including the use restrictions in their Section 3.2 and the [Gemma Prohibited Use Policy](https://ai.google.dev/gemma/prohibited_use_policy).