Skip to content

Commit abf28d5

Browse files
committed
update
1 parent db4b54c commit abf28d5

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

docs/source/en/modular_diffusers/write_own_pipeline_block.md

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,36 @@ image = load_image("https://huggingface.co/datasets/huggingface/documentation-im
248248
state = pipe(image=image, batch_size=2)
249249
print(f"pipeline_state (after update): {state}")
250250
```
251+
```out
252+
pipeline_state (before update): PipelineState(
253+
inputs={
254+
image: <PIL.Image.Image image mode=RGB size=512x512 at 0x7F3ECC494550>
255+
},
256+
intermediates={
257+
batch_size: 2
258+
},
259+
)
260+
block_state (before update): BlockState(
261+
image: <PIL.Image.Image image mode=RGB size=512x512 at 0x7F3ECC494640>
262+
batch_size: 2
263+
)
251264
265+
block_state (after update): BlockState(
266+
image: Tensor(dtype=torch.float32, shape=torch.Size([1, 3, 512, 512]))
267+
batch_size: 4
268+
processed_image: List[4] of Tensors with shapes [torch.Size([1, 3, 512, 512]), torch.Size([1, 3, 512, 512]), torch.Size([1, 3, 512, 512]), torch.Size([1, 3, 512, 512])]
269+
image_latents: Tensor(dtype=torch.float32, shape=torch.Size([1, 4, 64, 64]))
270+
)
271+
pipeline_state (after update): PipelineState(
272+
inputs={
273+
image: <PIL.Image.Image image mode=RGB size=512x512 at 0x7F3ECC494550>
274+
},
275+
intermediates={
276+
batch_size: 4
277+
image_latents: Tensor(dtype=torch.float32, shape=torch.Size([1, 4, 64, 64]))
278+
},
279+
)
280+
```
252281
**Key Observations:**
253282

254283
1. **Before the update**: `image` (the input) goes to the immutable inputs dict, while `batch_size` (the intermediate_input) goes to the mutable intermediates dict, and both are available in `block_state`.
@@ -670,7 +699,7 @@ class AutoIPAdapter(AutoPipelineBlocks):
670699
block_trigger_inputs = ["ip_adapter_image"]
671700
@property
672701
def description(self):
673-
return "Run IP Adapter step if `ip_adapter_image` is provided. This step should be placed before the 'input' step.\n"
702+
return "Run IP Adapter step if `ip_adapter_image` is provided."
674703
```
675704

676705
Now let's combine these 2 auto blocks together into a `SequentialPipelineBlocks`:
@@ -703,7 +732,7 @@ SequentialPipelineBlocks(
703732

704733
Sub-Blocks:
705734
[0] ip-adapter (AutoIPAdapter)
706-
Description: Run IP Adapter step if `ip_adapter_image` is provided. This step should be placed before the 'input' step.
735+
Description: Run IP Adapter step if `ip_adapter_image` is provided.
707736

708737

709738
[1] image-generation (AutoImageBlocks)

0 commit comments

Comments
 (0)