Skip to content

Commit a9ac96e

Browse files
committed
Merge remote-tracking branch 'upstream/main' into fix-wan_vace_prompt_embeds
2 parents 0ec7833 + 1448b03 commit a9ac96e

File tree

489 files changed

+15229
-1409
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

489 files changed

+15229
-1409
lines changed

.github/workflows/nightly_tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,9 @@ jobs:
340340
- backend: "optimum_quanto"
341341
test_location: "quanto"
342342
additional_deps: []
343+
- backend: "nvidia_modelopt"
344+
test_location: "modelopt"
345+
additional_deps: []
343346
runs-on:
344347
group: aws-g6e-xlarge-plus
345348
container:

docs/source/en/_toctree.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@
2424
title: Reproducibility
2525
- local: using-diffusers/schedulers
2626
title: Load schedulers and models
27+
- local: using-diffusers/models
28+
title: Models
2729
- local: using-diffusers/scheduler_features
2830
title: Scheduler features
2931
- local: using-diffusers/other-formats
3032
title: Model files and layouts
3133
- local: using-diffusers/push_to_hub
32-
title: Push files to the Hub
34+
title: Sharing pipelines and models
3335

3436
- title: Adapters
3537
isExpanded: false
@@ -58,12 +60,6 @@
5860
title: Batch inference
5961
- local: training/distributed_inference
6062
title: Distributed inference
61-
- local: using-diffusers/scheduler_features
62-
title: Scheduler features
63-
- local: using-diffusers/callback
64-
title: Pipeline callbacks
65-
- local: using-diffusers/image_quality
66-
title: Controlling image quality
6763

6864
- title: Inference optimization
6965
isExpanded: false
@@ -92,6 +88,8 @@
9288
title: xDiT
9389
- local: optimization/para_attn
9490
title: ParaAttention
91+
- local: using-diffusers/image_quality
92+
title: FreeU
9593

9694
- title: Hybrid Inference
9795
isExpanded: false
@@ -188,6 +186,8 @@
188186
title: torchao
189187
- local: quantization/quanto
190188
title: quanto
189+
- local: quantization/modelopt
190+
title: NVIDIA ModelOpt
191191

192192
- title: Model accelerators and hardware
193193
isExpanded: false

docs/source/en/api/image_processor.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ All pipelines with [`VaeImageProcessor`] accept PIL Image, PyTorch tensor, or Nu
2020

2121
[[autodoc]] image_processor.VaeImageProcessor
2222

23+
## InpaintProcessor
24+
25+
The [`InpaintProcessor`] accepts `mask` and `image` inputs and process them together. Optionally, it can accept padding_mask_crop and apply mask overlay.
26+
27+
[[autodoc]] image_processor.InpaintProcessor
28+
2329
## VaeImageProcessorLDM3D
2430

2531
The [`VaeImageProcessorLDM3D`] accepts RGB and depth inputs and returns RGB and depth outputs.

docs/source/en/api/pipelines/cogvideox.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ from diffusers.utils import export_to_video
5050
pipeline_quant_config = PipelineQuantizationConfig(
5151
quant_backend="torchao",
5252
quant_kwargs={"quant_type": "int8wo"},
53-
components_to_quantize=["transformer"]
53+
components_to_quantize="transformer"
5454
)
5555

5656
# fp8 layerwise weight-casting

docs/source/en/api/pipelines/hunyuan_video.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pipeline_quant_config = PipelineQuantizationConfig(
5454
"bnb_4bit_quant_type": "nf4",
5555
"bnb_4bit_compute_dtype": torch.bfloat16
5656
},
57-
components_to_quantize=["transformer"]
57+
components_to_quantize="transformer"
5858
)
5959

6060
pipeline = HunyuanVideoPipeline.from_pretrained(
@@ -91,7 +91,7 @@ pipeline_quant_config = PipelineQuantizationConfig(
9191
"bnb_4bit_quant_type": "nf4",
9292
"bnb_4bit_compute_dtype": torch.bfloat16
9393
},
94-
components_to_quantize=["transformer"]
94+
components_to_quantize="transformer"
9595
)
9696

9797
pipeline = HunyuanVideoPipeline.from_pretrained(
@@ -139,7 +139,7 @@ export_to_video(video, "output.mp4", fps=15)
139139
"bnb_4bit_quant_type": "nf4",
140140
"bnb_4bit_compute_dtype": torch.bfloat16
141141
},
142-
components_to_quantize=["transformer"]
142+
components_to_quantize="transformer"
143143
)
144144

145145
pipeline = HunyuanVideoPipeline.from_pretrained(

docs/source/en/api/pipelines/qwenimage.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Qwen-Image comes in the following variants:
2626
|:----------:|:--------:|
2727
| Qwen-Image | [`Qwen/Qwen-Image`](https://huggingface.co/Qwen/Qwen-Image) |
2828
| Qwen-Image-Edit | [`Qwen/Qwen-Image-Edit`](https://huggingface.co/Qwen/Qwen-Image-Edit) |
29+
| Qwen-Image-Edit Plus | [Qwen/Qwen-Image-Edit-2509](https://huggingface.co/Qwen/Qwen-Image-Edit-2509) |
2930

3031
<Tip>
3132

@@ -96,6 +97,29 @@ The `guidance_scale` parameter in the pipeline is there to support future guidan
9697

9798
</Tip>
9899

100+
## Multi-image reference with QwenImageEditPlusPipeline
101+
102+
With [`QwenImageEditPlusPipeline`], one can provide multiple images as input reference.
103+
104+
```
105+
import torch
106+
from PIL import Image
107+
from diffusers import QwenImageEditPlusPipeline
108+
from diffusers.utils import load_image
109+
110+
pipe = QwenImageEditPlusPipeline.from_pretrained(
111+
"Qwen/Qwen-Image-Edit-2509", torch_dtype=torch.bfloat16
112+
).to("cuda")
113+
114+
image_1 = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/grumpy.jpg")
115+
image_2 = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/peng.png")
116+
image = pipe(
117+
image=[image_1, image_2],
118+
prompt="put the penguin and the cat at a game show called "Qwen Edit Plus Games"",
119+
num_inference_steps=50
120+
).images[0]
121+
```
122+
99123
## QwenImagePipeline
100124

101125
[[autodoc]] QwenImagePipeline
@@ -120,7 +144,21 @@ The `guidance_scale` parameter in the pipeline is there to support future guidan
120144
- all
121145
- __call__
122146

123-
## QwenImaggeControlNetPipeline
147+
## QwenImageEditInpaintPipeline
148+
149+
[[autodoc]] QwenImageEditInpaintPipeline
150+
- all
151+
- __call__
152+
153+
## QwenImageControlNetPipeline
154+
155+
[[autodoc]] QwenImageControlNetPipeline
156+
- all
157+
- __call__
158+
159+
## QwenImageEditPlusPipeline
160+
161+
[[autodoc]] QwenImageEditPlusPipeline
124162
- all
125163
- __call__
126164

docs/source/en/modular_diffusers/components_manager.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ t2i_pipeline = t2i_blocks.init_pipeline(modular_repo_id, components_manager=comp
5151
</hfoption>
5252
</hfoptions>
5353

54-
Components are only loaded and registered when using [`~ModularPipeline.load_components`] or [`~ModularPipeline.load_default_components`]. The example below uses [`~ModularPipeline.load_default_components`] to create a second pipeline that reuses all the components from the first one, and assigns it to a different collection
54+
Components are only loaded and registered when using [`~ModularPipeline.load_components`] or [`~ModularPipeline.load_components`]. The example below uses [`~ModularPipeline.load_components`] to create a second pipeline that reuses all the components from the first one, and assigns it to a different collection
5555

5656
```py
57-
pipe.load_default_components()
57+
pipe.load_components()
5858
pipe2 = ModularPipeline.from_pretrained("YiYiXu/modular-demo-auto", components_manager=comp, collection="test2")
5959
```
6060

@@ -187,4 +187,4 @@ comp.enable_auto_cpu_offload(device="cuda")
187187

188188
All models begin on the CPU and [`ComponentsManager`] moves them to the appropriate device right before they're needed, and moves other models back to the CPU when GPU memory is low.
189189

190-
You can set your own rules for which models to offload first.
190+
You can set your own rules for which models to offload first.

docs/source/en/modular_diffusers/guiders.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ Guiders that are already saved on the Hub with a `modular_model_index.json` file
7575
}
7676
```
7777

78-
The guider is only created after calling [`~ModularPipeline.load_default_components`] based on the loading specification in `modular_model_index.json`.
78+
The guider is only created after calling [`~ModularPipeline.load_components`] based on the loading specification in `modular_model_index.json`.
7979

8080
```py
8181
t2i_pipeline = t2i_blocks.init_pipeline("YiYiXu/modular-doc-guider")
8282
# not created during init
8383
assert t2i_pipeline.guider is None
84-
t2i_pipeline.load_default_components()
84+
t2i_pipeline.load_components()
8585
# loaded as PAG guider
8686
t2i_pipeline.guider
8787
```
@@ -172,4 +172,4 @@ t2i_pipeline.push_to_hub("YiYiXu/modular-doc-guider")
172172
```
173173

174174
</hfoption>
175-
</hfoptions>
175+
</hfoptions>

docs/source/en/modular_diffusers/modular_pipeline.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ blocks = SequentialPipelineBlocks.from_blocks_dict(TEXT2IMAGE_BLOCKS)
2929
modular_repo_id = "YiYiXu/modular-loader-t2i-0704"
3030
pipeline = blocks.init_pipeline(modular_repo_id)
3131

32-
pipeline.load_default_components(torch_dtype=torch.float16)
32+
pipeline.load_components(torch_dtype=torch.float16)
3333
pipeline.to("cuda")
3434

3535
image = pipeline(prompt="Astronaut in a jungle, cold color palette, muted colors, detailed, 8k", output="images")[0]
@@ -49,7 +49,7 @@ blocks = SequentialPipelineBlocks.from_blocks_dict(IMAGE2IMAGE_BLOCKS)
4949
modular_repo_id = "YiYiXu/modular-loader-t2i-0704"
5050
pipeline = blocks.init_pipeline(modular_repo_id)
5151

52-
pipeline.load_default_components(torch_dtype=torch.float16)
52+
pipeline.load_components(torch_dtype=torch.float16)
5353
pipeline.to("cuda")
5454

5555
url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/sdxl-text2img.png"
@@ -73,7 +73,7 @@ blocks = SequentialPipelineBlocks.from_blocks_dict(INPAINT_BLOCKS)
7373
modular_repo_id = "YiYiXu/modular-loader-t2i-0704"
7474
pipeline = blocks.init_pipeline(modular_repo_id)
7575

76-
pipeline.load_default_components(torch_dtype=torch.float16)
76+
pipeline.load_components(torch_dtype=torch.float16)
7777
pipeline.to("cuda")
7878

7979
img_url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/sdxl-text2img.png"
@@ -176,15 +176,15 @@ diffdiff_pipeline = ModularPipeline.from_pretrained(modular_repo_id, trust_remot
176176

177177
## Loading components
178178

179-
A [`ModularPipeline`] doesn't automatically instantiate with components. It only loads the configuration and component specifications. You can load all components with [`~ModularPipeline.load_default_components`] or only load specific components with [`~ModularPipeline.load_components`].
179+
A [`ModularPipeline`] doesn't automatically instantiate with components. It only loads the configuration and component specifications. You can load all components with [`~ModularPipeline.load_components`] or only load specific components with [`~ModularPipeline.load_components`].
180180

181181
<hfoptions id="load">
182-
<hfoption id="load_default_components">
182+
<hfoption id="load_components">
183183

184184
```py
185185
import torch
186186

187-
t2i_pipeline.load_default_components(torch_dtype=torch.float16)
187+
t2i_pipeline.load_components(torch_dtype=torch.float16)
188188
t2i_pipeline.to("cuda")
189189
```
190190

@@ -355,4 +355,4 @@ The [config.json](https://huggingface.co/YiYiXu/modular-diffdiff-0704/blob/main/
355355
"ModularPipelineBlocks": "block.DiffDiffBlocks"
356356
}
357357
}
358-
```
358+
```

docs/source/en/modular_diffusers/quickstart.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ print(dd_blocks)
173173

174174
## ModularPipeline
175175

176-
Convert the [`SequentialPipelineBlocks`] into a [`ModularPipeline`] with the [`ModularPipeline.init_pipeline`] method. This initializes the expected components to load from a `modular_model_index.json` file. Explicitly load the components by calling [`ModularPipeline.load_default_components`].
176+
Convert the [`SequentialPipelineBlocks`] into a [`ModularPipeline`] with the [`ModularPipeline.init_pipeline`] method. This initializes the expected components to load from a `modular_model_index.json` file. Explicitly load the components by calling [`ModularPipeline.load_components`].
177177

178-
It is a good idea to initialize the [`ComponentManager`] with the pipeline to help manage the different components. Once you call [`~ModularPipeline.load_default_components`], the components are registered to the [`ComponentManager`] and can be shared between workflows. The example below uses the `collection` argument to assign the components a `"diffdiff"` label for better organization.
178+
It is a good idea to initialize the [`ComponentManager`] with the pipeline to help manage the different components. Once you call [`~ModularPipeline.load_components`], the components are registered to the [`ComponentManager`] and can be shared between workflows. The example below uses the `collection` argument to assign the components a `"diffdiff"` label for better organization.
179179

180180
```py
181181
from diffusers.modular_pipelines import ComponentsManager
@@ -209,11 +209,11 @@ Use the [`sub_blocks.insert`] method to insert it into the [`ModularPipeline`].
209209
dd_blocks.sub_blocks.insert("ip_adapter", ip_adapter_block, 0)
210210
```
211211

212-
Call [`~ModularPipeline.init_pipeline`] to initialize a [`ModularPipeline`] and use [`~ModularPipeline.load_default_components`] to load the model components. Load and set the IP-Adapter to run the pipeline.
212+
Call [`~ModularPipeline.init_pipeline`] to initialize a [`ModularPipeline`] and use [`~ModularPipeline.load_components`] to load the model components. Load and set the IP-Adapter to run the pipeline.
213213

214214
```py
215215
dd_pipeline = dd_blocks.init_pipeline("YiYiXu/modular-demo-auto", collection="diffdiff")
216-
dd_pipeline.load_default_components(torch_dtype=torch.float16)
216+
dd_pipeline.load_components(torch_dtype=torch.float16)
217217
dd_pipeline.loader.load_ip_adapter("h94/IP-Adapter", subfolder="sdxl_models", weight_name="ip-adapter_sdxl.bin")
218218
dd_pipeline.loader.set_ip_adapter_scale(0.6)
219219
dd_pipeline = dd_pipeline.to(device)
@@ -260,14 +260,14 @@ class SDXLDiffDiffControlNetDenoiseStep(StableDiffusionXLDenoiseLoopWrapper):
260260
controlnet_denoise_block = SDXLDiffDiffControlNetDenoiseStep()
261261
```
262262

263-
Insert the `controlnet_input` block and replace the `denoise` block with the new `controlnet_denoise_block`. Initialize a [`ModularPipeline`] and [`~ModularPipeline.load_default_components`] into it.
263+
Insert the `controlnet_input` block and replace the `denoise` block with the new `controlnet_denoise_block`. Initialize a [`ModularPipeline`] and [`~ModularPipeline.load_components`] into it.
264264

265265
```py
266266
dd_blocks.sub_blocks.insert("controlnet_input", control_input_block, 7)
267267
dd_blocks.sub_blocks["denoise"] = controlnet_denoise_block
268268

269269
dd_pipeline = dd_blocks.init_pipeline("YiYiXu/modular-demo-auto", collection="diffdiff")
270-
dd_pipeline.load_default_components(torch_dtype=torch.float16)
270+
dd_pipeline.load_components(torch_dtype=torch.float16)
271271
dd_pipeline = dd_pipeline.to(device)
272272

273273
control_image = load_image("https://huggingface.co/datasets/YiYiXu/testing-images/resolve/main/diffdiff_tomato_canny.jpeg")
@@ -320,7 +320,7 @@ Call [`SequentialPipelineBlocks.from_blocks_dict`] to create a [`SequentialPipel
320320
```py
321321
dd_auto_blocks = SequentialPipelineBlocks.from_blocks_dict(DIFFDIFF_AUTO_BLOCKS)
322322
dd_pipeline = dd_auto_blocks.init_pipeline("YiYiXu/modular-demo-auto", collection="diffdiff")
323-
dd_pipeline.load_default_components(torch_dtype=torch.float16)
323+
dd_pipeline.load_components(torch_dtype=torch.float16)
324324
```
325325

326326
## Share
@@ -340,5 +340,5 @@ from diffusers.modular_pipelines import ModularPipeline, ComponentsManager
340340
components = ComponentsManager()
341341

342342
diffdiff_pipeline = ModularPipeline.from_pretrained("YiYiXu/modular-diffdiff-0704", trust_remote_code=True, components_manager=components, collection="diffdiff")
343-
diffdiff_pipeline.load_default_components(torch_dtype=torch.float16)
344-
```
343+
diffdiff_pipeline.load_components(torch_dtype=torch.float16)
344+
```

0 commit comments

Comments
 (0)