Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Facebookresearch Audiocraft MAGNeT get pretrained

From Leeroopedia
Revision as of 12:33, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Facebookresearch_Audiocraft_MAGNeT_get_pretrained.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Sources
Domains Audio_Generation, Masked_Generation
Last Updated 2026-02-14 01:00 GMT

Overview

Concrete tool for loading pretrained MAGNeT non-autoregressive text-to-music and text-to-sound generation models.

Description

MAGNeT provides a high-level user-facing API for non-autoregressive audio generation. Unlike autoregressive models, the generation duration is fixed by the model configuration and not user-configurable at inference time. The set_generation_params method configures MAGNeT-specific parameters including annealed CFG, per-codebook decoding steps, and span arrangement.

Usage

Import this class when you want to generate music or sounds using the faster non-autoregressive MAGNeT approach.

Code Reference

Source Location

Signature

class MAGNeT(BaseGenModel):
    @staticmethod
    def get_pretrained(name: str = 'facebook/magnet-small-10secs', device=None):
        """Load a pretrained MAGNeT model."""

    def set_generation_params(self, use_sampling=True, top_k=0, top_p=0.9,
                              temperature=3.0, max_cfg_coef=10.0, min_cfg_coef=1.0,
                              decoding_steps=[20,10,10,10], span_arrangement='nonoverlap'):
        """Configure MAGNeT generation parameters."""

Import

from audiocraft.models import MAGNeT

I/O Contract

Inputs

Name Type Required Description
descriptions list[str] Yes Text descriptions for generation
name str No Pretrained model name

Outputs

Name Type Description
wav torch.Tensor Generated audio [B, C, T]

Usage Examples

from audiocraft.models import MAGNeT

model = MAGNeT.get_pretrained('facebook/magnet-small-10secs')
model.set_generation_params(temperature=3.0, top_p=0.9)
wav = model.generate(['upbeat electronic music with heavy bass'])

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment