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 class

AudioGenerationPipeline

AudioGenerationPipeline

class max.pipelines.audio.AudioGenerationPipeline(pipeline_config, pipeline_model)

source

Bases: Pipeline[AudioGenerationInputs[AudioGenerationContextType], GenerationOutput], Generic[AudioGenerationContextType]

Audio generation pipeline, driven by an AudioExecutor.

Unlike text generation, one request is one call: the executor runs every stage the model has – autoregressive, denoising, vocoding – and returns a finished waveform. The pipeline’s own job is only to hand the batch to the executor and turn its samples into a response.

Parameters:

execute()

execute(inputs)

source

Generates one waveform per request in the batch.

Parameters:

inputs (AudioGenerationInputs[AudioGenerationContextType])

Return type:

dict[RequestID, GenerationOutput]

max_batch_size

property max_batch_size: int

source

audio generation runs one request at a time.

Type:

Returns 1

pipeline_config

property pipeline_config: PipelineConfig

source

Returns the pipeline configuration.

prepare_batch()

prepare_batch(batch)

source

Delegates input preparation to the executor.

Parameters:

batch (dict[RequestID, AudioGenerationContextType]) – Maps each request ID to its AudioContext.

Returns:

The executor’s inputs, and the batch flattened to (request_id, context) pairs in the order the executor sees them, which is the order its waveforms come back in.

Raises:

ValueError – If the batch holds more than one request.

Return type:

tuple[Any, list[tuple[RequestID, AudioGenerationContextType]]]

release()

release(request_id)

source

Releases resources held for a request.

Nothing to do: an audio request holds no state between calls, since each one is generated in a single execute().

Parameters:

request_id (RequestID)

Return type:

None