Skip to content

Commit fa1a9cd

Browse files
committed
Merge branch 'main' into modular-qwen
2 parents 3bd289f + 9918d13 commit fa1a9cd

File tree

156 files changed

+9862
-4731
lines changed

Some content is hidden

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

156 files changed

+9862
-4731
lines changed

docs/source/en/_toctree.yml

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
- local: installation
66
title: Installation
77
- local: quicktour
8-
title: Quicktour
8+
title: Quickstart
99
- local: stable_diffusion
10-
title: Effective and efficient diffusion
10+
title: Basic performance
1111

1212
- title: DiffusionPipeline
1313
isExpanded: false
@@ -112,22 +112,24 @@
112112
sections:
113113
- local: modular_diffusers/overview
114114
title: Overview
115-
- local: modular_diffusers/modular_pipeline
116-
title: Modular Pipeline
117-
- local: modular_diffusers/components_manager
118-
title: Components Manager
115+
- local: modular_diffusers/quickstart
116+
title: Quickstart
119117
- local: modular_diffusers/modular_diffusers_states
120-
title: Modular Diffusers States
118+
title: States
121119
- local: modular_diffusers/pipeline_block
122-
title: Pipeline Block
120+
title: ModularPipelineBlocks
123121
- local: modular_diffusers/sequential_pipeline_blocks
124-
title: Sequential Pipeline Blocks
122+
title: SequentialPipelineBlocks
125123
- local: modular_diffusers/loop_sequential_pipeline_blocks
126-
title: Loop Sequential Pipeline Blocks
124+
title: LoopSequentialPipelineBlocks
127125
- local: modular_diffusers/auto_pipeline_blocks
128-
title: Auto Pipeline Blocks
129-
- local: modular_diffusers/end_to_end_guide
130-
title: End-to-End Example
126+
title: AutoPipelineBlocks
127+
- local: modular_diffusers/modular_pipeline
128+
title: ModularPipeline
129+
- local: modular_diffusers/components_manager
130+
title: ComponentsManager
131+
- local: modular_diffusers/guiders
132+
title: Guiders
131133

132134
- title: Training
133135
isExpanded: false
@@ -282,6 +284,18 @@
282284
title: Outputs
283285
- local: api/quantization
284286
title: Quantization
287+
- title: Modular
288+
sections:
289+
- local: api/modular_diffusers/pipeline
290+
title: Pipeline
291+
- local: api/modular_diffusers/pipeline_blocks
292+
title: Blocks
293+
- local: api/modular_diffusers/pipeline_states
294+
title: States
295+
- local: api/modular_diffusers/pipeline_components
296+
title: Components and configs
297+
- local: api/modular_diffusers/guiders
298+
title: Guiders
285299
- title: Loaders
286300
sections:
287301
- local: api/loaders/ip_adapter
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Guiders
2+
3+
Guiders are components in Modular Diffusers that control how the diffusion process is guided during generation. They implement various guidance techniques to improve generation quality and control.
4+
5+
## BaseGuidance
6+
7+
[[autodoc]] diffusers.guiders.guider_utils.BaseGuidance
8+
9+
## ClassifierFreeGuidance
10+
11+
[[autodoc]] diffusers.guiders.classifier_free_guidance.ClassifierFreeGuidance
12+
13+
## ClassifierFreeZeroStarGuidance
14+
15+
[[autodoc]] diffusers.guiders.classifier_free_zero_star_guidance.ClassifierFreeZeroStarGuidance
16+
17+
## SkipLayerGuidance
18+
19+
[[autodoc]] diffusers.guiders.skip_layer_guidance.SkipLayerGuidance
20+
21+
## SmoothedEnergyGuidance
22+
23+
[[autodoc]] diffusers.guiders.smoothed_energy_guidance.SmoothedEnergyGuidance
24+
25+
## PerturbedAttentionGuidance
26+
27+
[[autodoc]] diffusers.guiders.perturbed_attention_guidance.PerturbedAttentionGuidance
28+
29+
## AdaptiveProjectedGuidance
30+
31+
[[autodoc]] diffusers.guiders.adaptive_projected_guidance.AdaptiveProjectedGuidance
32+
33+
## AutoGuidance
34+
35+
[[autodoc]] diffusers.guiders.auto_guidance.AutoGuidance
36+
37+
## TangentialClassifierFreeGuidance
38+
39+
[[autodoc]] diffusers.guiders.tangential_classifier_free_guidance.TangentialClassifierFreeGuidance
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Pipeline
2+
3+
## ModularPipeline
4+
5+
[[autodoc]] diffusers.modular_pipelines.modular_pipeline.ModularPipeline
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Pipeline blocks
2+
3+
## ModularPipelineBlocks
4+
5+
[[autodoc]] diffusers.modular_pipelines.modular_pipeline.ModularPipelineBlocks
6+
7+
## SequentialPipelineBlocks
8+
9+
[[autodoc]] diffusers.modular_pipelines.modular_pipeline.SequentialPipelineBlocks
10+
11+
## LoopSequentialPipelineBlocks
12+
13+
[[autodoc]] diffusers.modular_pipelines.modular_pipeline.LoopSequentialPipelineBlocks
14+
15+
## AutoPipelineBlocks
16+
17+
[[autodoc]] diffusers.modular_pipelines.modular_pipeline.AutoPipelineBlocks
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Components and configs
2+
3+
## ComponentSpec
4+
5+
[[autodoc]] diffusers.modular_pipelines.modular_pipeline.ComponentSpec
6+
7+
## ConfigSpec
8+
9+
[[autodoc]] diffusers.modular_pipelines.modular_pipeline.ConfigSpec
10+
11+
## ComponentsManager
12+
13+
[[autodoc]] diffusers.modular_pipelines.components_manager.ComponentsManager
14+
15+
## InsertableDict
16+
17+
[[autodoc]] diffusers.modular_pipelines.modular_pipeline_utils.InsertableDict
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Pipeline states
2+
3+
## PipelineState
4+
5+
[[autodoc]] diffusers.modular_pipelines.modular_pipeline.PipelineState
6+
7+
## BlockState
8+
9+
[[autodoc]] diffusers.modular_pipelines.modular_pipeline.BlockState

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ Original model checkpoints for Flux can be found [here](https://huggingface.co/b
2525

2626
Flux can be quite expensive to run on consumer hardware devices. However, you can perform a suite of optimizations to run it faster and in a more memory-friendly manner. Check out [this section](https://huggingface.co/blog/sd3#memory-optimizations-for-sd3) for more details. Additionally, Flux can benefit from quantization for memory efficiency with a trade-off in inference latency. Refer to [this blog post](https://huggingface.co/blog/quanto-diffusers) to learn more. For an exhaustive list of resources, check out [this gist](https://gist.github.com/sayakpaul/b664605caf0aa3bf8585ab109dd5ac9c).
2727

28+
[Caching](../../optimization/cache) may also speed up inference by storing and reusing intermediate outputs.
29+
2830
</Tip>
2931

3032
Flux comes in the following variants:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
<Tip>
2020

21-
Make sure to check out the Schedulers [guide](../../using-diffusers/schedulers) to learn how to explore the tradeoff between scheduler speed and quality, and see the [reuse components across pipelines](../../using-diffusers/loading#reuse-a-pipeline) section to learn how to efficiently load the same components into multiple pipelines.
21+
[Caching](../../optimization/cache) may also speed up inference by storing and reusing intermediate outputs.
2222

2323
</Tip>
2424

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export_to_video(video, "output.mp4", fps=24)
8888
</hfoption>
8989
<hfoption id="inference speed">
9090

91-
[Compilation](../../optimization/fp16#torchcompile) is slow the first time but subsequent calls to the pipeline are faster.
91+
[Compilation](../../optimization/fp16#torchcompile) is slow the first time but subsequent calls to the pipeline are faster. [Caching](../../optimization/cache) may also speed up inference by storing and reusing intermediate outputs.
9292

9393
```py
9494
import torch

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

Lines changed: 83 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,100 @@
1616

1717
Qwen-Image from the Qwen team is an image generation foundation model in the Qwen series that achieves significant advances in complex text rendering and precise image editing. Experiments show strong general capabilities in both image generation and editing, with exceptional performance in text rendering, especially for Chinese.
1818

19-
Check out the model card [here](https://huggingface.co/Qwen/Qwen-Image) to learn more.
19+
Qwen-Image comes in the following variants:
20+
21+
| model type | model id |
22+
|:----------:|:--------:|
23+
| Qwen-Image | [`Qwen/Qwen-Image`](https://huggingface.co/Qwen/Qwen-Image) |
24+
| Qwen-Image-Edit | [`Qwen/Qwen-Image-Edit`](https://huggingface.co/Qwen/Qwen-Image-Edit) |
2025

2126
<Tip>
2227

23-
Make sure to check out the Schedulers [guide](../../using-diffusers/schedulers) to learn how to explore the tradeoff between scheduler speed and quality, and see the [reuse components across pipelines](../../using-diffusers/loading#reuse-a-pipeline) section to learn how to efficiently load the same components into multiple pipelines.
28+
[Caching](../../optimization/cache) may also speed up inference by storing and reusing intermediate outputs.
2429

2530
</Tip>
2631

32+
## LoRA for faster inference
33+
34+
Use a LoRA from `lightx2v/Qwen-Image-Lightning` to speed up inference by reducing the
35+
number of steps. Refer to the code snippet below:
36+
37+
<details>
38+
<summary>Code</summary>
39+
40+
```py
41+
from diffusers import DiffusionPipeline, FlowMatchEulerDiscreteScheduler
42+
import torch
43+
import math
44+
45+
ckpt_id = "Qwen/Qwen-Image"
46+
47+
# From
48+
# https://github.com/ModelTC/Qwen-Image-Lightning/blob/342260e8f5468d2f24d084ce04f55e101007118b/generate_with_diffusers.py#L82C9-L97C10
49+
scheduler_config = {
50+
"base_image_seq_len": 256,
51+
"base_shift": math.log(3), # We use shift=3 in distillation
52+
"invert_sigmas": False,
53+
"max_image_seq_len": 8192,
54+
"max_shift": math.log(3), # We use shift=3 in distillation
55+
"num_train_timesteps": 1000,
56+
"shift": 1.0,
57+
"shift_terminal": None, # set shift_terminal to None
58+
"stochastic_sampling": False,
59+
"time_shift_type": "exponential",
60+
"use_beta_sigmas": False,
61+
"use_dynamic_shifting": True,
62+
"use_exponential_sigmas": False,
63+
"use_karras_sigmas": False,
64+
}
65+
scheduler = FlowMatchEulerDiscreteScheduler.from_config(scheduler_config)
66+
pipe = DiffusionPipeline.from_pretrained(
67+
ckpt_id, scheduler=scheduler, torch_dtype=torch.bfloat16
68+
).to("cuda")
69+
pipe.load_lora_weights(
70+
"lightx2v/Qwen-Image-Lightning", weight_name="Qwen-Image-Lightning-8steps-V1.0.safetensors"
71+
)
72+
73+
prompt = "a tiny astronaut hatching from an egg on the moon, Ultra HD, 4K, cinematic composition."
74+
negative_prompt = " "
75+
image = pipe(
76+
prompt=prompt,
77+
negative_prompt=negative_prompt,
78+
width=1024,
79+
height=1024,
80+
num_inference_steps=8,
81+
true_cfg_scale=1.0,
82+
generator=torch.manual_seed(0),
83+
).images[0]
84+
image.save("qwen_fewsteps.png")
85+
```
86+
87+
</details>
88+
2789
## QwenImagePipeline
2890

2991
[[autodoc]] QwenImagePipeline
3092
- all
3193
- __call__
3294

95+
## QwenImageImg2ImgPipeline
96+
97+
[[autodoc]] QwenImageImg2ImgPipeline
98+
- all
99+
- __call__
100+
101+
## QwenImageInpaintPipeline
102+
103+
[[autodoc]] QwenImageInpaintPipeline
104+
- all
105+
- __call__
106+
107+
## QwenImageEditPipeline
108+
109+
[[autodoc]] QwenImageEditPipeline
110+
- all
111+
- __call__
112+
33113
## QwenImagePipelineOutput
34114

35-
[[autodoc]] pipelines.qwenimage.pipeline_output.QwenImagePipelineOutput
115+
[[autodoc]] pipelines.qwenimage.pipeline_output.QwenImagePipelineOutput

0 commit comments

Comments
 (0)