Nodes/ComfyUI-Replicate/Replicate lucataco/magnet
ComfyUI Node

Replicate lucataco/magnet

Meta's MAGNeT text-to-music in ComfyUI

By replicate·Created 2 years ago·Updated 2 years ago· 207
Replicate lucataco/magnet
    • AUDIO
    ◄prompt80s electronic track with melodic synthesizers, catchy beat and groovy bass►
    ◄modelfacebook/magnet-small-10secs►
    ◄variations3►
    ◄span_scoreprod-stride1►
    ◄temperature3.00►
    ◄top_p0.90►
    ◄max_cfg10.00►
    ◄min_cfg1.00►
    ◄decoding_steps_stage_120►
    ◄decoding_steps_stage_210►
    ◄decoding_steps_stage_310►
    ◄decoding_steps_stage_410►
    ◄force_rerunfalse►

    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, from facebook/magnet-small-10secs (default) up to facebook/magnet-medium-30secs, plus two audio-magnet variants 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) and top_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.

    CategoryReplicate

    Inputs (13)

    NameTypeDefaultDescription
    promptoptSTRING80s electronic track with melodic synthesizers, catchy beat and groovy bass—
    modeloptCOMBOfacebook/magnet-small-10secs6 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
    variationsoptINT31–4—
    span_scoreoptCOMBOprod-stride12 options: max-nonoverlap, prod-stride1
    temperatureoptFLOAT3.00—
    top_poptFLOAT0.900–1—
    max_cfgoptFLOAT10.00—
    min_cfgoptFLOAT1.00—
    decoding_steps_stage_1optINT20—
    decoding_steps_stage_2optINT10—
    decoding_steps_stage_3optINT10—
    decoding_steps_stage_4optINT10—
    force_rerunoptBOOLEANfalse—

    Outputs (1)

    NameTypeDescription
    AUDIOAUDIO—