IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Python module

max.pipelines.architectures.minimax_music3

Generates music from a text description and lyrics.

MiniMaxMusic3ArchConfig​

class max.pipelines.architectures.minimax_music3.MiniMaxMusic3ArchConfig(*, pipeline_config, quantization_encoding=None)

source

Bases: ArchConfig

Configures the MiniMax Music 3 pipeline without a KV cache.

Unlike text models, this pipeline does not cache the request’s tokens. The autoregressive stage caches generated audio frames instead, so it allocates that cache itself and this config has no KV cache parameters to set.

Parameters:

DEFAULT_ENCODING​

DEFAULT_ENCODING: ClassVar[SupportedEncoding] = 'bfloat16'

source

SUPPORTED_ENCODINGS​

SUPPORTED_ENCODINGS: ClassVar[set[SupportedEncoding]] = {'bfloat16'}

source

calculate_max_seq_len()​

classmethod calculate_max_seq_len(huggingface_config, model_config)

source

Returns the tokenizer’s fixed prompt limit of MAX_PROMPT_TOKENS.

Other architectures bound the user’s requested max_length here. This model has one prompt limit, so a requested length has no effect.

Parameters:

Return type:

int

get_max_seq_len()​

get_max_seq_len()

source

Returns the tokenizer’s maximum prompt length in tokens.

Return type:

int

initialize()​

classmethod initialize(pipeline_config, model_config=None, *, max_seq_len)

source

Validates that the checkpoint can run.

Parameters:

  • pipeline_config (PipelineConfig) – The pipeline configuration.
  • model_config (MAXModelConfig | None) – The model configuration to read from.
  • max_seq_len (int) – Ignored. The ArchConfig protocol requires this argument, but this model’s sequence length is fixed by the tokenizer.

Raises:

ValueError – If the manifest has no transformer component, or if more than one device was requested.

Return type:

Self

pipeline_config​

pipeline_config: PipelineConfig

source

quantization_encoding​

quantization_encoding: SupportedEncoding | None = None

source

MiniMaxMusic3Config​

class max.pipelines.architectures.minimax_music3.MiniMaxMusic3Config(vocoder=<factory>, condition_encoder=<factory>, transformer=<factory>, depth_decoder=<factory>, language_model=<factory>, sampling=<factory>)

source

Bases: object

The five component configurations plus the pipeline-level constants.

Parameters:

  • vocoder (VocoderConfig)
  • condition_encoder (ConditionEncoderConfig)
  • transformer (TransformerConfig)
  • depth_decoder (DepthDecoderConfig)
  • language_model (LanguageModelConfig)
  • sampling (SamplingConfig)

condition_encoder​

condition_encoder: ConditionEncoderConfig

source

depth_decoder​

depth_decoder: DepthDecoderConfig

source

frame_rate​

property frame_rate: float

source

The autoregressive frame rate, in frames per second.

from_dicts()​

static from_dicts(configs)

source

Builds a configuration from each component’s parsed config.json.

Parameters:

configs (Mapping[str, Mapping[str, Any]]) – The parsed config.json contents, keyed by the checkpoint’s role names. Those names are the subfolders listed in the component index.

Raises:

KeyError – If a component is missing.

Return type:

MiniMaxMusic3Config

from_pretrained()​

static from_pretrained(root)

source

Loads every component configuration from a checkpoint directory.

Parameters:

root (Path | str)

Return type:

MiniMaxMusic3Config

language_model​

language_model: LanguageModelConfig

source

latent_hop_length​

property latent_hop_length: int

source

The latent hop length, in samples.

sampling​

sampling: SamplingConfig

source

sampling_rate​

property sampling_rate: int

source

The output audio sample rate, in Hz.

transformer​

transformer: TransformerConfig

source

vocoder​

vocoder: VocoderConfig

source

MiniMaxMusic3Executor​

class max.pipelines.architectures.minimax_music3.MiniMaxMusic3Executor(manifest, session, runtime_config)

source

Bases: PipelineExecutor[AudioContext, MiniMaxMusic3Inputs, AudioExecutorOutputs]

Turns a text prompt and lyrics into music, one request at a time.

Parameters:

execute()​

execute(inputs)

source

Runs the language model, diffusion, and vocoder stages, returning the finished stereo waveform.

Parameters:

inputs (MiniMaxMusic3Inputs)

Return type:

AudioExecutorOutputs

prepare_inputs()​

prepare_inputs(contexts)

source

Embeds the prompt pair and settles the generation’s size.

Raises:

ValueError – If the batch is not exactly one request, or if the context carries no guidance prompt.

Parameters:

contexts (list[AudioContext])

Return type:

MiniMaxMusic3Inputs

sample_rate​

property sample_rate: int

source

The vocoder’s sample rate of 44100 Hz.

MiniMaxMusic3Inputs​

class max.pipelines.architectures.minimax_music3.MiniMaxMusic3Inputs(prompt, prompt_length, max_frames, num_inference_steps, guidance_scale, seed)

source

Bases: TensorStruct

One request, stored as tensors.

The prompt arrives already embedded rather than as token ids, which keeps the model’s 200000-row embedding table off the device. See embed_text().

Parameters:

guidance_scale​

guidance_scale: Tensor

source

Classifier-free guidance scale for the denoiser, 1-element float32.

max_frames​

max_frames: Tensor

source

Upper bound on generated frames, 1-element int64. The model may stop earlier, and usually does.

num_inference_steps​

num_inference_steps: Tensor

source

Euler steps per denoising window, 1-element int64.

prompt​

prompt: Tensor

source

The conditional prompt embeddings and the classifier-free guidance prompt embeddings, laid end to end. Shape is (2 * prompt_length, hidden_size).

prompt_length​

prompt_length: Tensor

source

The number of tokens in each prompt. A 1-element int64 tensor. Both rows share one length.

seed​

seed: Tensor

source

RNG seed for both the code sampling and the denoising noise, 1-element int64.

MiniMaxMusic3Tokenizer​

class max.pipelines.architectures.minimax_music3.MiniMaxMusic3Tokenizer(*args, **kwargs)

source

Bases: AudioGenerationTokenizer

Builds the conditional and unconditional prompts for MiniMax Music 3.

Parameters:

  • args – Forwarded to AudioGenerationTokenizer.
  • kwargs – Forwarded to AudioGenerationTokenizer, with max_length defaulting to the checkpoint’s prompt limit and the duration and step count to this checkpoint’s own.

assemble_prompt()​

assemble_prompt(description, lyrics)

source

Returns the assembled prompt.

Parameters:

  • description (str) – The request’s prompt.
  • lyrics (str | None) – The lyrics to sing.

Returns:

The assembled prompt.

Raises:

ValueError – If the request carried no lyrics. This model always sings, and an empty lyric field makes it hum through a prompt the checkpoint never saw in training.

Return type:

str

unconditional_ids()​

unconditional_ids(token_ids)

source

Returns the prompt with its content replaced by the CFG token.

Everything between the opening <|im_start|> and the closing <|im_end|><|audio_start|> becomes one repeated token, so the unconditional prompt is the same length as the conditional prompt. The two prompts are batched together.

Parameters:

token_ids (ndarray[tuple[Any, ...], dtype[int64]]) – The conditional prompt’s token ids.

Returns:

The unconditional prompt’s token ids.

Return type:

ndarray[tuple[Any, …], dtype[int64]]