Diffusers documentation

Pipeline blocks

You are viewing main version, which requires installation from source. If you'd like regular pip install, checkout the latest stable version (v0.34.0).
Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

Pipeline blocks

ModularPipelineBlocks

class diffusers.ModularPipelineBlocks

< >

( )

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

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

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

combine_inputs

< >

( *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

< >

( *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

< >

( state: PipelineState )

Get all inputs and intermediates in one dictionary

init_pipeline

< >

( 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

< >

( )

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

< >

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

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

< >

( )

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

< >

( 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

< >

( )

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