#
Pipeline blocks

##
ModularPipelineBlocks

###
class diffusers.ModularPipelineBlocks

< source >

( )

Base class for all Pipeline Blocks: PipelineBlock, AutoPipelineBlocks, SequentialPipelineBlocks, LoopSequentialPipelineBlocks

ModularPipelineBlocks provides method to load and save the definition of pipeline blocks.

This is an experimental feature and is likely to change in the future.

####
combine_inputs

< source >

( *named_input_lists: typing.List[typing.Tuple[str, typing.List[diffusers.modular_pipelines.modular_pipeline_utils.InputParam]]] ) →
List[InputParam]

Parameters

- named_input_lists — List of tuples containing (block_name, input_param_list) pairs

Returns

List[InputParam]

Combined list of unique InputParam objects

Combines multiple lists of InputParam objects from different blocks. For duplicate inputs, updates only if current default value is None and new default value is not None. Warns if multiple non-None default values exist for the same input.

####
combine_outputs

< source >

( *named_output_lists: typing.List[typing.Tuple[str, typing.List[diffusers.modular_pipelines.modular_pipeline_utils.OutputParam]]] ) →
List[OutputParam]

Parameters

- named_output_lists — List of tuples containing (block_name, output_param_list) pairs

Returns

List[OutputParam]

Combined list of unique OutputParam objects

Combines multiple lists of OutputParam objects from different blocks. For duplicate outputs, keeps the first occurrence of each output name.

####
get_block_state

< source >

( state: PipelineState )

Get all inputs and intermediates in one dictionary

####
init_pipeline

< source >

( pretrained_model_name_or_path: typing.Union[str, os.PathLike, NoneType] = None components_manager: typing.Optional[diffusers.modular_pipelines.components_manager.ComponentsManager] = None collection: typing.Optional[str] = None )

create a ModularPipeline, optionally accept modular_repo to load from hub.

##
SequentialPipelineBlocks

###
class diffusers.modular_pipelines.SequentialPipelineBlocks

< source >

( )

Parameters

- block_classes — List of block classes to be used
- block_names — List of prefixes for each block

A Pipeline Blocks that combines multiple pipeline block classes into one. When called, it will call each block in sequence.

This class inherits from ModularPipelineBlocks. Check the superclass documentation for the generic methods the library implements for all the pipeline blocks (such as loading or saving etc.)

This is an experimental feature and is likely to change in the future.

####
from_blocks_dict

< source >

( blocks_dict: typing.Dict[str, typing.Any] description: typing.Optional[str] = None )

Parameters

- blocks_dict — Dictionary mapping block names to block classes or instances

Creates a SequentialPipelineBlocks instance from a dictionary of blocks.

##
LoopSequentialPipelineBlocks

###
class diffusers.modular_pipelines.LoopSequentialPipelineBlocks

< source >

( )

Parameters

- block_classes — List of block classes to be used
- block_names — List of prefixes for each block

A Pipeline blocks that combines multiple pipeline block classes into a For Loop. When called, it will call each block in sequence.

This class inherits from ModularPipelineBlocks. Check the superclass documentation for the generic methods the library implements for all the pipeline blocks (such as loading or saving etc.)

This is an experimental feature and is likely to change in the future.

####
from_blocks_dict

< source >

( blocks_dict: typing.Dict[str, typing.Any] )

Parameters

- blocks_dict — Dictionary mapping block names to block instances

Creates a LoopSequentialPipelineBlocks instance from a dictionary of blocks.

##
AutoPipelineBlocks

###
class diffusers.modular_pipelines.AutoPipelineBlocks

< source >

( )

Parameters

- block_classes — List of block classes to be used
- block_names — List of prefixes for each block
- block_trigger_inputs — List of input names that trigger specific blocks, with None for default

A Pipeline Blocks that automatically selects a block to run based on the inputs.

This class inherits from ModularPipelineBlocks. Check the superclass documentation for the generic methods the library implements for all the pipeline blocks (such as loading or saving etc.)

This is an experimental feature and is likely to change in the future.

< > Update on GitHub