Instructions to use MusicForge/magnet-small-8bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use MusicForge/magnet-small-8bit with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download MusicForge/magnet-small-8bit --local-dir magnet-small-8bit
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
Mirror from aufklarer/MAGNeT-Small-30secs-MLX-8bit
Browse files- README.md +67 -0
- compression_state_dict.bin +3 -0
- config.json +34 -0
- model.safetensors +3 -0
README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-nc-4.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
tags:
|
| 6 |
+
- mlx
|
| 7 |
+
- audio
|
| 8 |
+
- music
|
| 9 |
+
- text-to-music
|
| 10 |
+
- magnet
|
| 11 |
+
- quantized
|
| 12 |
+
- int8
|
| 13 |
+
base_model: facebook/magnet-small-30secs
|
| 14 |
+
library_name: mlx
|
| 15 |
+
pipeline_tag: text-to-audio
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# MAGNeT-Small-30secs-MLX-8bit
|
| 19 |
+
|
| 20 |
+
- [speech-swift](https://github.com/soniqo/speech-swift) — Apple SDK
|
| 21 |
+
- [soniqo.audio](https://soniqo.audio) — website
|
| 22 |
+
- [blog](https://soniqo.audio/blog) — blog
|
| 23 |
+
|
| 24 |
+
MLX port of Meta's [MAGNeT](https://arxiv.org/abs/2401.04577) — a masked
|
| 25 |
+
parallel text-to-music model — quantized to **INT8** weight-only for
|
| 26 |
+
on-device generation on Apple Silicon. EnCodec 32 kHz audio decoder; T5-base
|
| 27 |
+
text encoder; per-codebook iterative decoding with restricted-context
|
| 28 |
+
self-attention.
|
| 29 |
+
|
| 30 |
+
## Model
|
| 31 |
+
|
| 32 |
+
| | |
|
| 33 |
+
|---|---|
|
| 34 |
+
| Parameters (LM) | 300M |
|
| 35 |
+
| Quantization | INT8 weight-only, group size 64 |
|
| 36 |
+
| Format | MLX safetensors |
|
| 37 |
+
| Sample rate | 32 kHz mono |
|
| 38 |
+
| Output length | 30 s per generation (fixed) |
|
| 39 |
+
| Decoding steps | 50 total (`[20, 10, 10, 10]` across 4 RVQ codebooks) |
|
| 40 |
+
| Bundle size | 691 MB on disk |
|
| 41 |
+
| Source | [facebook/magnet-small-30secs](https://huggingface.co/facebook/magnet-small-30secs) |
|
| 42 |
+
|
| 43 |
+
## Performance (Apple Silicon, 30 s audio)
|
| 44 |
+
|
| 45 |
+
| Metric | Value |
|
| 46 |
+
|---|---|
|
| 47 |
+
| Real-time factor (wall / audio) | **0.29** |
|
| 48 |
+
| Peak RSS | 1543 MB |
|
| 49 |
+
| CLAP score (laion/clap-htsat-unfused, 5 prompts) | 0.438 |
|
| 50 |
+
|
| 51 |
+
## Usage
|
| 52 |
+
|
| 53 |
+
```python
|
| 54 |
+
from huggingface_hub import snapshot_download
|
| 55 |
+
bundle = snapshot_download("aufklarer/MAGNeT-Small-30secs-MLX-8bit")
|
| 56 |
+
# See https://github.com/soniqo/speech-swift for production usage.
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
## Source
|
| 60 |
+
|
| 61 |
+
- Upstream: [facebook/magnet-small-30secs](https://huggingface.co/facebook/magnet-small-30secs)
|
| 62 |
+
- Paper: [MAGNeT (arxiv 2401.04577)](https://arxiv.org/abs/2401.04577)
|
| 63 |
+
- Audiocraft: [facebookresearch/audiocraft](https://github.com/facebookresearch/audiocraft)
|
| 64 |
+
|
| 65 |
+
## License
|
| 66 |
+
|
| 67 |
+
**CC-BY-NC 4.0** — inherited from upstream MAGNeT weights. Non-commercial use only.
|
compression_state_dict.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:91598c7da3d183eb8e0cc19cbbdc4f64f2d0c53069f9c8aa84185d0e33873c67
|
| 3 |
+
size 236003715
|
config.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"n_q": 4,
|
| 3 |
+
"card": 2048,
|
| 4 |
+
"dim": 1024,
|
| 5 |
+
"num_heads": 16,
|
| 6 |
+
"num_layers": 24,
|
| 7 |
+
"ffn_dim": 4096,
|
| 8 |
+
"segment_duration": 30,
|
| 9 |
+
"frame_rate": 50,
|
| 10 |
+
"subcodes_context": 5,
|
| 11 |
+
"span_len": 3,
|
| 12 |
+
"sample_rate": 32000,
|
| 13 |
+
"t5_name": "t5-base",
|
| 14 |
+
"t5_dim": 768,
|
| 15 |
+
"encodec_name": "encodec-32khz",
|
| 16 |
+
"quantization": {
|
| 17 |
+
"mode": "mlx_affine",
|
| 18 |
+
"bits": 8,
|
| 19 |
+
"group_size": 64,
|
| 20 |
+
"targets": [
|
| 21 |
+
"self_attn.q_proj.weight",
|
| 22 |
+
"self_attn.k_proj.weight",
|
| 23 |
+
"self_attn.v_proj.weight",
|
| 24 |
+
"self_attn.out_proj.weight",
|
| 25 |
+
"cross_attn.q_proj.weight",
|
| 26 |
+
"cross_attn.k_proj.weight",
|
| 27 |
+
"cross_attn.v_proj.weight",
|
| 28 |
+
"cross_attn.out_proj.weight",
|
| 29 |
+
"linear1.weight",
|
| 30 |
+
"linear2.weight"
|
| 31 |
+
]
|
| 32 |
+
},
|
| 33 |
+
"format": "int8"
|
| 34 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bad102a8df600b9221b891986e8e15255ec2a40143bc92d5a3f265b0bff45052
|
| 3 |
+
size 488815540
|