Replicate lucataco/magnet
Meta's MAGNeT text-to-music in ComfyUI
- AUDIO
MAGNeT is Meta's text-to-music and text-to-audio model - you describe a track ("80s electronic track with melodic synthesizers, catchy beat and groovy bass") and it generates it. Its claim to fame is speed: it's a masked, non-autoregressive generator, which means it doesn't build the audio token-by-token the way MusicGen does, so it's noticeably faster. This node drops that into ComfyUI via ComfyUI-Replicate.
As with everything in the pack, it runs on Replicate's cloud, not your machine. Prompt in, audio back.
How it works
Autoregressive audio models predict one chunk after another, which is slow. MAGNeT instead predicts masked spans of audio tokens in parallel over a few decoding stages, then refines them - that's where the speed comes from, and it's why you'll see several "decoding steps" inputs. The node sends your prompt and settings to Replicate, runs the model there, and returns an AUDIO output. No local compute, pay-per-run, cloud latency.
Inputs and outputs that matter
Output: AUDIO.
prompt- describe the music: genre, instruments, mood, tempo. Detail helps.model- six variants, fromfacebook/magnet-small-10secs(default) up tofacebook/magnet-medium-30secs, plus twoaudio-magnetvariants tuned for sound effects rather than music. Pick by length (10 vs 30 seconds) and whether you want music or SFX.variations(3) - how many different takes to generate, 1 to 4.temperature(3) andtop_p(0.9) - sampling randomness; higher is more adventurous.
The four decoding_steps_stage_* inputs control the multi-stage decode - leave them at defaults unless you're deliberately trading quality against speed. max_cfg/min_cfg and span_score are advanced knobs you can ignore at first. force_rerun forces a fresh generation on identical inputs.
How to install it
ComfyUI Manager: search ComfyUI-Replicate, install, restart. Manual route:
cd ComfyUI/custom_nodes
git clone https://github.com/replicate/comfyui-replicate
cd comfyui-replicate
pip install -r requirements.txt
Restart, and set your token before launching:
export REPLICATE_API_TOKEN="r8_************"; python main.py
Token from replicate.com/account/api-tokens.
Common issues
The big one is baked into the pack. Its README states it's designed for models returning simple text or image, and warns that audio outputs "will not work as expected" - audio and video support are still on the roadmap. MAGNeT returns audio, so treat the AUDIO output as the rough edge: it may run fine, but if saving or previewing the clip misbehaves, that's the known limitation, not your graph.
Otherwise: a missing REPLICATE_API_TOKEN is the usual first-run error, generating 4 variations of a 30-second track costs more than one 10-second take (so iterate cheap, then scale up), and expect cloud latency on each call. If the music sounds generic, put more specific detail in the prompt - instruments, era, tempo - rather than reaching for the sampling knobs first.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| promptopt | STRING | 80s electronic track with melodic synthesizers, catchy beat and groovy bass | — |
| modelopt | COMBO | facebook/magnet-small-10secs | 6 options: facebook/magnet-small-10secs, facebook/magnet-medium-10secs, facebook/magnet-small-30secs, facebook/magnet-medium-30secs, facebook/audio-magnet-small, facebook/audio-magnet-medium |
| variationsopt | INT | 31–4 | — |
| span_scoreopt | COMBO | prod-stride1 | 2 options: max-nonoverlap, prod-stride1 |
| temperatureopt | FLOAT | 3.00 | — |
| top_popt | FLOAT | 0.900–1 | — |
| max_cfgopt | FLOAT | 10.00 | — |
| min_cfgopt | FLOAT | 1.00 | — |
| decoding_steps_stage_1opt | INT | 20 | — |
| decoding_steps_stage_2opt | INT | 10 | — |
| decoding_steps_stage_3opt | INT | 10 | — |
| decoding_steps_stage_4opt | INT | 10 | — |
| force_rerunopt | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| AUDIO | AUDIO | — |