Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/diffusers/modular_pipelines/modular_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -2182,6 +2182,14 @@ def blocks(self) -> ModularPipelineBlocks:
Returns:
- A copy of the pipeline blocks
"""
# In-place edits of this copy (for example `pipe.blocks.sub_blocks.insert(...)`) do not
# change the pipeline. Say so once, and point at the supported path.
if not getattr(ModularPipeline.blocks.fget, "_warned_about_copy", False):
logger.warning(
"`pipeline.blocks` is a copy, so in-place edits do not change this pipeline. "
"Edit the blocks, then create a new pipeline with `blocks.init_pipeline()`."
)
ModularPipeline.blocks.fget._warned_about_copy = True
return deepcopy(self._blocks)

def register_components(self, **kwargs):
Expand Down
Loading