Skip to main content

Audio & music generation

The whole AudioCraft stack, running on a single 24GB card

MusicGen, AudioGen, MAGNeT, JASCO, EnCodec, MultiBand Diffusion and AudioSeal all ship from one repo. Installing it is harder than running it — VRAM is not your bottleneck.

AudioCraft is Meta FAIR's open audio-generation research library: MIT code, CC-BY-NC 4.0 weights. What ships is not one model but a whole chain. EnCodec compresses 32kHz waveforms into 4 codebooks of discrete tokens at 50 frames per second. MusicGen is a single-stage autoregressive Transformer that predicts those tokens directly. MultiBand Diffusion can replace the EnCodec decoder to reconstruct cleaner audio from the same tokens. AudioSeal stamps a sample-level watermark on the result. Add the non-autoregressive MAGNeT, text-to-sound AudioGen, and chord- and drum-conditioned JASCO, and one repository covers compression, generation, decoding and provenance end to end.

The VRAM numbers first, because that is what most people actually came for. AudioCraft's loaders.py contains a hard rule: if the device is cpu use float32, otherwise use float16. Put it on a GPU and the language model runs in fp16, period. musicgen-small's state_dict.bin is 840MB, musicgen-medium is 3.68GB, musicgen-large is 6.51GB, and every size shares the same 236MB compression_state_dict.bin holding the EnCodec weights. The docs give a single blanket figure — at least 16GB of GPU memory for inference with the 1.5B medium models — which is deliberately conservative, assuming full 30-second stereo plus batch headroom. A single 30-second mono generation will not OOM medium on a 12GB card, and large has plenty of room on 24GB.

What actually stops people is the dependency wall. requirements.txt pins torch==2.1.0, torchvision==0.16.0, torchtext==0.16.0, xformers<0.0.23, numpy<2.0.0, av==11.0.0 and spacy==3.7.6. The official torch 2.1.0 wheels top out at CUDA 12.1 and only compile up to sm_90, while torchtext was archived by PyTorch in September 2025 with a final 0.18 release that supports Python 3.11 at most. So: Python must be 3.9–3.11, and your GPU must be Ampere, Ada, Hopper or older, because Blackwell's sm_120 simply has no kernels under these pins. That is not bad engineering — the last commit landed in March 2025 and the dependency world kept moving without it. Every recommendation below is shaped by that fact.

01 —

What is actually inside AudioCraft

Main is 1.4.0a2; the PyPI stable release is still 1.3.0. All weights live under the facebook org on Hugging Face

VersionParametersVRAMContextNotes
MusicGen small / medium / large (plus stereo variants)300M / 1.5B / 3.3Bfp16 weights 0.84GB / 3.68GB / 6.51GB; plan for 8GB / 16GB / 24GB in practice30 seconds (1503 tokens; EnCodec 32kHz, 4 codebooks @ 50Hz)The workhorse text-to-music model. Stereo checkpoints were fine-tuned 200k steps from the mono ones, interleaving two token streams with the delay pattern — double the token budget, so slower and hungrier for the same duration. Meta names medium as the best quality-versus-compute trade-off.
MusicGen-melody / melody-large1.5B / 3.3Bfp16 weights 3.68GB / 6.51GB, plus 2–3GB headroom for Demucs30 seconds, extendable via extend_stride windowingTakes a reference melody as chroma conditioning through generate_with_chroma(). Note that it invokes Demucs for source separation before extracting chroma — an extra memory and latency cost that most VRAM budgets forget to include.
MusicGen-Style1.5B (medium only)roughly 3.7GB of fp16 weights; budget 16GB per the docs30-second output, style excerpt of 1.5–4.5 secondsUses a short audio clip as a style prompt. The knobs that matter are eval_q (1–6, how tightly it clings to the reference audio) and double classifier-free guidance via cfg_coef_beta (1–9, how far the text description overrides the style). This is the one for 'give me something in the vibe of this'.
MAGNeT / audio-magnet300M / 1.5B, each with 10s and 30s checkpointscomparable to MusicGen at the same size; docs say 16GB for the 1.5B tierFixed 10s or 30s; audio-magnet runs at 16kHzNon-autoregressive masked generation — it does not emit one token at a time, so its latency profile is nothing like MusicGen's. Reach for it when you want interactive, low-latency drafts. The catch: duration is baked into the checkpoint, with no sliding-window continuation.
AudioGen-medium1.5B (medium is the only release)about 3.5GB in fp16; docs say 16GB16kHz EnCodec, 4 codebooks @ 50Hz, 5 seconds by default and configurableText-to-sound rather than text-to-music: dog barking, emergency sirens, footsteps in a corridor. Meta states plainly that the released architecture differs from the AudioGen paper, traded for faster generation. This is the one for game and film sound-effect libraries.
JASCO chords-drums / chords-drums-melody400M / 1Broughly 0.8GB / 2GB in fp16 by parameter count; a 12GB card is enoughFixed 10 secondsThe temporally-conditioned model added in 1.4.0a2, taking text plus a chord progression plus a drum track plus optional melody at once. The price is building chord_extractor from source, and Deepsalience on top for melody conditioning — by far the most painful install path in the repo.

02 —

Which GPU to rent

Check architecture before VRAM: the cu121 wheels for torch 2.1.0 only compile up to sm_90, so pick around that line

  • Prompt iteration and bulk drafting on musicgen-small and MAGNeT-small

    RTX 3090 24GB$0.193/GPU-hr

    sm_86 is natively covered by the cu121 wheels, a 300M model will never fill 24GB, and this is the cheapest VRAM per dollar on the list — ideal for the high-frequency, low-intensity work of grinding through prompts.

  • Final renders on musicgen-large 3.3B, 30-second stereo, several in parallel

    RTX 4090 24GB$0.540/GPU-hr

    6.51GB of fp16 weights plus the doubled stereo KV cache fits in 24GB with room to spare, and sm_89 is the last consumer generation cu121 supports — while still being the fastest single-card autoregressive decoder at this price.

  • Adding the MultiBand Diffusion decoder for quality, or fine-tuning small/medium

    RTX A6000 48GB$0.817/GPU-hr

    MBD keeps four diffusion models resident alongside MusicGen and runs multi-step denoising, so it costs both memory and time on top. 48GB means you never have to choose between enabling MBD and raising batch size.

  • Full fine-tuning of musicgen-medium, or multi-GPU Dora training grids

    A100 SXM4 80GB$1.088/GPU-hr

    Full AdamW on 1.5B costs roughly 18GB in optimizer state and fp32 master weights before activations and EnCodec, which makes 48GB tight. A100's sm_80 is a first-class citizen on torch 2.1.0, and a node here takes up to 14 GPUs for distributed Dora runs.

03 —

From bare instance to first audio file

Four steps — the one that breaks people is the version pinning in step one

  1. 01

    Spin up an instance on a Python 3.9–3.11 PyTorch image

    Launch an RTX 4090 24GB at console.nexgpu.net and pick a base PyTorch image from the 2,000+ prebuilt ones. The critical move is dropping torch back to the pinned 2.1.0 on cu121: torchtext 0.16.0 pairs only with torch 2.1.0, and torchtext itself was archived in September 2025 with a final 0.18 release capped at Python 3.11. Installing this stack on Python 3.12 cannot work — that failure is not your fault.

    pip install torch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0 --index-url https://download.pytorch.org/whl/cu121
  2. 02

    Install AudioCraft itself, and FFmpeg

    The PyPI stable release stops at 1.3.0 from June 2024, which has MAGNeT and MusicGen-Style but no JASCO — for JASCO you need main at 1.4.0a2. Pin numpy below 2.0 first or spacy 3.7.6 and av 11.0.0 will fail in a cascade. FFmpeg replaced torchaudio for audio I/O back in 1.1.0, so without it even saving a wav will fail.

    apt-get install -y ffmpeg && pip install "numpy<2.0.0" && pip install -U git+https://github.com/facebookresearch/audiocraft#egg=audiocraft
  3. 03

    Pull the weights, render your first 30 seconds

    get_pretrained() fetches state_dict.bin and compression_state_dict.bin from Hugging Face — about 6.75GB total for the large tier. Set AUDIOCRAFT_CACHE_DIR to a data volume rather than the system disk so you are not re-downloading after every restart. audio_write with strategy='loudness' normalises levels and hands you a usable master straight away.

    python -c "from audiocraft.models import MusicGen; from audiocraft.data.audio import audio_write; m=MusicGen.get_pretrained('facebook/musicgen-large'); m.set_generation_params(duration=30); w=m.generate(['lo-fi hip hop, warm rhodes, vinyl crackle, 82 bpm']); audio_write('out', w[0].cpu(), m.sample_rate, strategy='loudness')"
  4. 04

    On newer GPUs, take the transformers route instead

    If you rented something Blackwell like the RTX 5090 32GB, sm_120 has no kernels in the cu121 wheels for torch 2.1.0 and the official pins are a dead end. Switch to MusicgenForConditionalGeneration in Hugging Face transformers, which runs on any modern torch. The trade-off: no melody, style, MAGNeT or JASCO — just the base MusicGen tiers, still under the same 1503-token (30-second) ceiling.

    pip install torch --index-url https://download.pytorch.org/whl/cu128 && pip install -U transformers scipy

What a batch of demos actually costs

Real arithmetic: 100 clips of 30-second stereo from musicgen-large. Rent an RTX 4090 24GB at $0.540/GPU-hr. Spend the first hour installing dependencies, pulling the 6.51GB state_dict.bin plus the 236MB compression_state_dict.bin, and rendering the first clip; then run four hours of batch generation. That is 5 hours x $0.540 = $2.70. Budget 30GB of storage for weights, conda environment and outputs — at the $0.414/GB-month median, keeping it three days costs 30 x 0.414 x 3 / 30 = $1.24. Each 30-second 32kHz 16-bit stereo WAV is 32000 x 2 x 2 x 30, about 3.84MB, so 100 of them is roughly 384MB; at the $0.0081/GB median egress rate that is 0.375 x 0.0081, about $0.003. Total: $3.94. To go cheaper, swap in a Tesla V100 32GB at $0.188/GPU-hr and the same five hours costs $0.94 — it is sm_70 with real FP16 tensor cores, natively supported on torch 2.1.0, and 32GB swallows 6.51GB of weights easily, though it has no bf16 and no modern attention kernels, so raw decode is slower than a 4090. For full fine-tuning of musicgen-medium, an A100 SXM4 80GB at $1.088/GPU-hr for 10 hours is $10.88. Everything meters per second and prices per hour, compute billing stops the moment the instance stops, and there is no minimum, no setup fee and no quota request — just remember that storage keeps billing until you destroy the volume.

04 —

Frequently asked questions

How much VRAM does MusicGen really need? Is the official 16GB figure accurate?

The docs give a blanket 'at least 16GB' for the 1.5B medium tier and above, but that is a conservative number assuming batching and full 30-second stereo. By actual weight size: 0.84GB fp16 for small, 3.68GB for medium, 6.51GB for large, plus the shared 236MB EnCodec. A single 30-second mono generation will not OOM medium on a 12GB card and leaves large comfortable on 24GB — but the moment you go stereo (double the token stream) or raise batch size, that 16GB advice becomes real. On NexGPU you can settle it empirically: an RTX 3090 24GB at $0.193/hr costs under three cents for a ten-minute test of your exact config, which beats guessing on your laptop.

Why does pip install audiocraft keep throwing dependency conflicts?

Because requirements.txt pins torch==2.1.0, torchvision==0.16.0, torchtext==0.16.0, xformers<0.0.23, numpy<2.0.0, av==11.0.0 and spacy==3.7.6, and the repo's last commit was a JASCO checkpoint-path fix in March 2025. torchtext was archived by PyTorch in September 2025, with a final 0.18 release that supports Python 3.11 at most. The working recipe is: Python 3.10, install cu121 torch 2.1.0 first, pin numpy below 2.0 second, install audiocraft last. Pick a clean PyTorch base from NexGPU's 2,000+ prebuilt images and a from-scratch retry takes minutes, instead of repeatedly poisoning a local conda environment.

Can I use MusicGen output commercially?

The code is MIT and yours to use. The weights are CC-BY-NC 4.0, explicitly non-commercial, and that applies to every facebook/* checkpoint for MusicGen, AudioGen, MAGNeT, MusicGen-Style and JASCO. The training set was 20,000 hours of licensed music from Shutterstock, Pond5 and the Meta Music Initiative, which is exactly why the licence stops where it does. The one exception in the repo is AudioSeal — code and weights both MIT, explicitly cleared for commercial use since April 2024. If you are building a commercial product, the real path is using AudioCraft's training code on a catalogue you own, which is precisely what an A100 SXM4 80GB at $1.088/GPU-hr is for.

Why is MusicGen capped at 30 seconds, and can I generate longer tracks?

Thirty seconds is a hard EnCodec token budget: 32kHz, 50 frames per second, 4 codebooks, which works out to 1503 tokens — and in audio-prompted continuation the input audio eats into that same allowance. To go longer you use extend_stride windowing, feeding the tail of the previous window back as conditioning; you can chain to any length, but harmony and structure drift as the window slides. MAGNeT is stricter still: 10s and 30s are separate checkpoints with no continuation mechanism at all. In practice long-form means generating segments and stitching them, which is really just running many short generations — a workload that suits NexGPU's per-second metering, where iteration costs exactly the seconds you occupied.

Can an RTX 5090 run AudioCraft?

Not from the official requirements. The torch 2.1.0 wheels stop at CUDA 12.1 and compile no further than sm_90, while the 5090 is Blackwell sm_120 — you will get 'no kernel image is available' on the first forward pass. Two ways out: abandon the pins and run transformers' MusicgenForConditionalGeneration on torch 2.7+/cu128, which works but leaves you with base MusicGen only; or stay on sm_90 and below. On NexGPU, RTX 4090 24GB at $0.540/GPU-hr and RTX A6000 48GB at $0.817/GPU-hr are both natively covered by cu121 and work out of the box. One warning: the Tesla P40 24GB looks tempting at $0.214, but Pascal's FP16 throughput is 1/64 of its FP32 rate, and AudioCraft forces fp16 on GPU — it will be unusably slow. Skip that bargain.

Is AudioCraft still maintained? Is it still worth using?

Main sits at 1.4.0a2, the last commit was a March 2025 fix to JASCO checkpoint loading, and PyPI stable is still the June 2024 1.3.0 release. By any reasonable standard this is a frozen research repository — do not expect it to follow new torch versions or new architectures. Frozen is not the same as useless, though: it remains the only open library packaging controllable text-to-music, text-to-sound, neural audio codecs, a diffusion decoder and audio watermarking behind one training and inference codebase, MusicGen's melody and style conditioning still have no equivalent open replacement, and the training code genuinely runs. The pragmatic move is to treat it as a toolbox sealed at a fixed version: snapshot a Python 3.10 plus torch 2.1.0 environment on NexGPU, bring up a 4090 in minutes when you need it, and stop it when you are done — environment rot stops being your local machine's problem.

Start building on NexGPU

Enterprise R&D team or solo developer — either way, your first job can be running in minutes.

Sign up to browse live network pricing. No payment method required.