Skip to main content

Python class

PixelGenerationPipeline

PixelGenerationPipeline

class max.pipelines.PixelGenerationPipeline(pipeline_config, pipeline_model, cache_config=None)

source

Bases: Pipeline[PixelGenerationInputs[PixelGenerationContextType], GenerationOutput], Generic[PixelGenerationContextType]

Pixel generation pipeline for diffusion models.

Parameters:

  • pipeline_config (PipelineConfig) – Configuration for the pipeline and runtime behavior.
  • pipeline_model (type[DiffusionPipeline] | type[PipelineExecutor[Any, Any, Any]]) – The diffusion pipeline model class to instantiate.
  • cache_config (DenoisingCacheConfig | None)

execute()

execute(inputs)

source

Runs the pixel generation pipeline for the given inputs.

Parameters:

inputs (PixelGenerationInputs[PixelGenerationContextType])

Return type:

dict[RequestID, GenerationOutput]

pipeline_config

property pipeline_config: PipelineConfig

source

Return the pipeline configuration.

prepare_batch()

prepare_batch(batch)

source

Prepare model inputs for pixel generation execution.

Delegates to the pipeline model for model-specific input preparation.

Parameters:

batch (dict[RequestID, PixelGenerationContextType]) – Dictionary mapping request IDs to their PixelContext objects.

Returns:

  • Model inputs ready for execution, or None if batch is empty.
  • list: Flattened batch as (request_id, context) tuples for response mapping.

Return type:

A tuple of

Raises:

ValueError – If batch size is larger than 1 (not yet supported).

release()

release(request_id)

source

Release resources associated with a request.

Parameters:

request_id (RequestID) – The request ID to release resources for.

Return type:

None