Buckets:
Pipeline blocks
ModularPipelineBlocks[[diffusers.ModularPipelineBlocks]]
diffusers.ModularPipelineBlocks[[diffusers.ModularPipelineBlocks]]
Base class for all Pipeline Blocks: ConditionalPipelineBlocks, 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.
get_block_statediffusers.ModularPipelineBlocks.get_block_statehttps://github.com/huggingface/diffusers/blob/vr_13171/src/diffusers/modular_pipelines/modular_pipeline.py#L459[{"name": "state", "val": ": PipelineState"}] Get all inputs and intermediates in one dictionary
get_execution_blocks[[diffusers.ModularPipelineBlocks.get_execution_blocks]]
Get the block(s) that would execute given the inputs. Must be implemented by subclasses that support conditional block selection.
Parameters:
- **kwargs : Input names and values. Only trigger inputs affect block selection.
get_workflow[[diffusers.ModularPipelineBlocks.get_workflow]]
Get the execution blocks for a specific workflow. Must be implemented by subclasses that define
_workflow_map.
Parameters:
workflow_name : Name of the workflow to retrieve.
init_pipeline[[diffusers.ModularPipelineBlocks.init_pipeline]]
create a ModularPipeline, optionally accept pretrained_model_name_or_path to load from hub.
SequentialPipelineBlocks[[diffusers.SequentialPipelineBlocks]]
diffusers.SequentialPipelineBlocks[[diffusers.SequentialPipelineBlocks]]
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_dictdiffusers.SequentialPipelineBlocks.from_blocks_dicthttps://github.com/huggingface/diffusers/blob/vr_13171/src/diffusers/modular_pipelines/modular_pipeline.py#L964[{"name": "blocks_dict", "val": ": dict"}, {"name": "description", "val": ": str | None = None"}]- blocks_dict -- Dictionary mapping block names to block classes or instances0A new SequentialPipelineBlocks instance Creates a SequentialPipelineBlocks instance from a dictionary of blocks.
Parameters:
block_classes : list of block classes to be used
block_names : list of prefixes for each block
Returns:
A new SequentialPipelineBlocks instance
get_execution_blocks[[diffusers.SequentialPipelineBlocks.get_execution_blocks]]
Get the blocks that would execute given the specified inputs.
As the traversal walks through sequential blocks, intermediate outputs from resolved blocks are added to the active inputs. This means conditional blocks that depend on intermediates (e.g., "run img2img if image_latents is present") will resolve correctly, as long as the condition is based on presence/absence (None or not None), not on the actual value.
Parameters:
- **kwargs : Input names and values. Only trigger inputs affect block selection.
Returns:
SequentialPipelineBlocks containing only the blocks that would execute
LoopSequentialPipelineBlocks[[diffusers.LoopSequentialPipelineBlocks]]
diffusers.LoopSequentialPipelineBlocks[[diffusers.LoopSequentialPipelineBlocks]]
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_dictdiffusers.LoopSequentialPipelineBlocks.from_blocks_dicthttps://github.com/huggingface/diffusers/blob/vr_13171/src/diffusers/modular_pipelines/modular_pipeline.py#L1398[{"name": "blocks_dict", "val": ": dict"}]- blocks_dict -- Dictionary mapping block names to block instances0A new LoopSequentialPipelineBlocks instance
Creates a LoopSequentialPipelineBlocks instance from a dictionary of blocks.
Parameters:
block_classes : list of block classes to be used
block_names : list of prefixes for each block
Returns:
A new LoopSequentialPipelineBlocks instance
AutoPipelineBlocks[[diffusers.AutoPipelineBlocks]]
diffusers.AutoPipelineBlocks[[diffusers.AutoPipelineBlocks]]
A Pipeline Blocks that automatically selects a block to run based on the presence of trigger inputs.
This is a specialized version of ConditionalPipelineBlocks where:
- Each block has one corresponding trigger input (1:1 mapping)
- Block selection is automatic: the first block whose trigger input is present gets selected
block_trigger_inputsmust have the same length asblock_namesandblock_classes- Use
Noneinblock_trigger_inputsto specify the default block, i.e the block that will run if no trigger inputs are present
Example:
class MyAutoBlock(AutoPipelineBlocks):
block_classes = [InpaintEncoderBlock, ImageEncoderBlock, TextEncoderBlock]
block_names = ["inpaint", "img2img", "text2img"]
block_trigger_inputs = ["mask_image", "image", None] # text2img is the default
With this definition:
- As long as
mask_imageis provided, "inpaint" block runs (regardless ofimagebeing provided or not) - If
mask_imageis not provided butimageis provided, "img2img" block runs - Otherwise, "text2img" block runs (default, trigger is
None)
select_blockdiffusers.AutoPipelineBlocks.select_blockhttps://github.com/huggingface/diffusers/blob/vr_13171/src/diffusers/modular_pipelines/modular_pipeline.py#L889[{"name": "**kwargs", "val": ""}] Select block based on which trigger input is present (not None).
Parameters:
block_classes : List of block classes to be used. Must have the same length as block_names and block_trigger_inputs.
block_names : List of names for each block. Must have the same length as block_classes and block_trigger_inputs.
block_trigger_inputs : List of input names where each element specifies the trigger input for the corresponding block. Use None to mark the default block.
Xet Storage Details
- Size:
- 7.72 kB
- Xet hash:
- a9cafcf76cfadceb5a08cf2067de8fd51a7803f15961f16314cb0cfa0cdccd95
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.