From cd26e94c0e2434e149f6b8985263fda8d0c36774 Mon Sep 17 00:00:00 2001 From: simpleqt <89645338+simpleqt@users.noreply.github.com> Date: Sun, 6 Sep 2026 01:17:13 +0800 Subject: [PATCH 1/9] docs: fix latent -> latents in LTX latent upsampler docstrings __call__ takes 'latents' (the docstring said 'latent', and its own description says 'Input latents to normalize'). --- src/diffusers/pipelines/ltx/pipeline_ltx_latent_upsample.py | 2 +- src/diffusers/pipelines/ltx2/pipeline_ltx2_latent_upsample.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/diffusers/pipelines/ltx/pipeline_ltx_latent_upsample.py b/src/diffusers/pipelines/ltx/pipeline_ltx_latent_upsample.py index fbf98ce976d9..6f325237a248 100644 --- a/src/diffusers/pipelines/ltx/pipeline_ltx_latent_upsample.py +++ b/src/diffusers/pipelines/ltx/pipeline_ltx_latent_upsample.py @@ -97,7 +97,7 @@ def adain_filter_latent(self, latents: torch.Tensor, reference_latents: torch.Te tensor. Args: - latent (`torch.Tensor`): + latents (`torch.Tensor`): Input latents to normalize reference_latents (`torch.Tensor`): The reference latents providing style statistics. diff --git a/src/diffusers/pipelines/ltx2/pipeline_ltx2_latent_upsample.py b/src/diffusers/pipelines/ltx2/pipeline_ltx2_latent_upsample.py index 4d085ca8f4ca..8aa72a425e1c 100644 --- a/src/diffusers/pipelines/ltx2/pipeline_ltx2_latent_upsample.py +++ b/src/diffusers/pipelines/ltx2/pipeline_ltx2_latent_upsample.py @@ -171,7 +171,7 @@ def adain_filter_latent(self, latents: torch.Tensor, reference_latents: torch.Te tensor. Args: - latent (`torch.Tensor`): + latents (`torch.Tensor`): Input latents to normalize reference_latents (`torch.Tensor`): The reference latents providing style statistics. From 47875958feae7d600cf99a7ac457e977e409361d Mon Sep 17 00:00:00 2001 From: simpleqt <89645338+simpleqt@users.noreply.github.com> Date: Sun, 6 Sep 2026 00:47:15 +0800 Subject: [PATCH 2/9] docs: fix 'promt' typo in kandinsky5 default prompt templates The default system template sent to the Qwen text encoder misspelled 'prompt engineer' as 'promt engineer' (4 pipelines). Note: this changes the token sequence of the default template, so default outputs will differ numerically from before / from the upstream Kandinsky5 reference. If exact parity with the reference repo is preferred, the reference itself would need the same fix. --- src/diffusers/pipelines/kandinsky5/pipeline_kandinsky.py | 2 +- src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_i2i.py | 2 +- src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_i2v.py | 2 +- src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_t2i.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky.py b/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky.py index 1ce885b21f5b..c8a725e4a7f3 100644 --- a/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky.py +++ b/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky.py @@ -188,7 +188,7 @@ def __init__( self.prompt_template = "\n".join( [ - "<|im_start|>system\nYou are a promt engineer. Describe the video in detail.", + "<|im_start|>system\nYou are a prompt engineer. Describe the video in detail.", "Describe how the camera moves or shakes, describe the zoom and view angle, whether it follows the objects.", "Describe the location of the video, main characters or objects and their action.", "Describe the dynamism of the video and presented actions.", diff --git a/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_i2i.py b/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_i2i.py index 0a8382d6031f..507991374dd2 100644 --- a/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_i2i.py +++ b/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_i2i.py @@ -174,7 +174,7 @@ def __init__( tokenizer_2=tokenizer_2, scheduler=scheduler, ) - self.prompt_template = "<|im_start|>system\nYou are a promt engineer. Based on the provided source image (first image) and target image (second image), create an interesting text prompt that can be used together with the source image to create the target image:<|im_end|><|im_start|>user{}<|vision_start|><|image_pad|><|vision_end|><|im_end|>" + self.prompt_template = "<|im_start|>system\nYou are a prompt engineer. Based on the provided source image (first image) and target image (second image), create an interesting text prompt that can be used together with the source image to create the target image:<|im_end|><|im_start|>user{}<|vision_start|><|image_pad|><|vision_end|><|im_end|>" self.prompt_template_encode_start_idx = 55 self.vae_scale_factor_spatial = 8 diff --git a/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_i2v.py b/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_i2v.py index 634305daff6b..d5bfe362a83c 100644 --- a/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_i2v.py +++ b/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_i2v.py @@ -185,7 +185,7 @@ def __init__( self.prompt_template = "\n".join( [ - "<|im_start|>system\nYou are a promt engineer. Describe the video in detail.", + "<|im_start|>system\nYou are a prompt engineer. Describe the video in detail.", "Describe how the camera moves or shakes, describe the zoom and view angle, whether it follows the objects.", "Describe the location of the video, main characters or objects and their action.", "Describe the dynamism of the video and presented actions.", diff --git a/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_t2i.py b/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_t2i.py index 2a58d4bed33a..c39f9c1b3333 100644 --- a/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_t2i.py +++ b/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_t2i.py @@ -175,7 +175,7 @@ def __init__( scheduler=scheduler, ) - self.prompt_template = "<|im_start|>system\nYou are a promt engineer. Describe the image by detailing the color, shape, size, texture, quantity, text, spatial relationships of the objects and background:<|im_end|>\n<|im_start|>user\n{}<|im_end|>" + self.prompt_template = "<|im_start|>system\nYou are a prompt engineer. Describe the image by detailing the color, shape, size, texture, quantity, text, spatial relationships of the objects and background:<|im_end|>\n<|im_start|>user\n{}<|im_end|>" self.prompt_template_encode_start_idx = 41 self.vae_scale_factor_spatial = 8 From 283da206fbd2242d9f2e1e3a965d49cad0a2d639 Mon Sep 17 00:00:00 2001 From: simpleqt <89645338+simpleqt@users.noreply.github.com> Date: Sun, 6 Sep 2026 00:46:37 +0800 Subject: [PATCH 3/9] docs: fix docstring parameter names that do not match signatures - flux controlnet encode_prompt documented a clip_skip parameter that does not exist (copy-paste from SD-style docs; flux has no CLIP layer-skipping) - hunyuan_video1_5 pipelines documented num_images_per_prompt while the parameter is num_videos_per_prompt - kandinsky5 _encode_prompt_qwen/_encode_prompt_clip documented num_videos_per_prompt, which neither method accepts --- src/diffusers/pipelines/flux/pipeline_flux_controlnet.py | 3 --- .../pipelines/hunyuan_video1_5/pipeline_hunyuan_video1_5.py | 2 +- .../hunyuan_video1_5/pipeline_hunyuan_video1_5_image2video.py | 2 +- src/diffusers/pipelines/kandinsky5/pipeline_kandinsky.py | 2 -- 4 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/diffusers/pipelines/flux/pipeline_flux_controlnet.py b/src/diffusers/pipelines/flux/pipeline_flux_controlnet.py index e7792d667f16..1483d6cf98b7 100644 --- a/src/diffusers/pipelines/flux/pipeline_flux_controlnet.py +++ b/src/diffusers/pipelines/flux/pipeline_flux_controlnet.py @@ -368,9 +368,6 @@ def encode_prompt( pooled_prompt_embeds (`torch.FloatTensor`, *optional*): Pre-generated pooled text embeddings. Can be used to easily tweak text inputs, *e.g.* prompt weighting. If not provided, pooled text embeddings will be generated from `prompt` input argument. - clip_skip (`int`, *optional*): - Number of layers to be skipped from CLIP while computing the prompt embeddings. A value of 1 means that - the output of the pre-final layer will be used for computing the prompt embeddings. lora_scale (`float`, *optional*): A lora scale that will be applied to all LoRA layers of the text encoder if LoRA layers are loaded. """ diff --git a/src/diffusers/pipelines/hunyuan_video1_5/pipeline_hunyuan_video1_5.py b/src/diffusers/pipelines/hunyuan_video1_5/pipeline_hunyuan_video1_5.py index a0adff493ac0..7232ebbee5b8 100644 --- a/src/diffusers/pipelines/hunyuan_video1_5/pipeline_hunyuan_video1_5.py +++ b/src/diffusers/pipelines/hunyuan_video1_5/pipeline_hunyuan_video1_5.py @@ -352,7 +352,7 @@ def encode_prompt( torch device batch_size (`int`): batch size of prompts, defaults to 1 - num_images_per_prompt (`int`): + num_videos_per_prompt (`int`): number of images that should be generated per prompt prompt_embeds (`torch.Tensor`, *optional*): Pre-generated text embeddings. If not provided, text embeddings will be generated from `prompt` input diff --git a/src/diffusers/pipelines/hunyuan_video1_5/pipeline_hunyuan_video1_5_image2video.py b/src/diffusers/pipelines/hunyuan_video1_5/pipeline_hunyuan_video1_5_image2video.py index 1d33c2ae188f..71a36a1c51cd 100644 --- a/src/diffusers/pipelines/hunyuan_video1_5/pipeline_hunyuan_video1_5_image2video.py +++ b/src/diffusers/pipelines/hunyuan_video1_5/pipeline_hunyuan_video1_5_image2video.py @@ -440,7 +440,7 @@ def encode_prompt( torch device batch_size (`int`): batch size of prompts, defaults to 1 - num_images_per_prompt (`int`): + num_videos_per_prompt (`int`): number of images that should be generated per prompt prompt_embeds (`torch.Tensor`, *optional*): Pre-generated text embeddings. If not provided, text embeddings will be generated from `prompt` input diff --git a/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky.py b/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky.py index c8a725e4a7f3..56098a0a7550 100644 --- a/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky.py +++ b/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky.py @@ -326,7 +326,6 @@ def _encode_prompt_qwen( Args: prompt (str | list[str]): Input prompt or list of prompts device (torch.device): Device to run encoding on - num_videos_per_prompt (int): Number of videos to generate per prompt max_sequence_length (int): Maximum sequence length for tokenization dtype (torch.dtype): Data type for embeddings @@ -395,7 +394,6 @@ def _encode_prompt_clip( Args: prompt (str | list[str]): Input prompt or list of prompts device (torch.device): Device to run encoding on - num_videos_per_prompt (int): Number of videos to generate per prompt dtype (torch.dtype): Data type for embeddings Returns: From c4ffda39919358a67a683b752c61baba2f862e77 Mon Sep 17 00:00:00 2001 From: simpleqt <89645338+simpleqt@users.noreply.github.com> Date: Sun, 6 Sep 2026 00:38:52 +0800 Subject: [PATCH 4/9] docs(zh): fix English anchors pointing at translated Chinese headings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit speed-memory-optims.md linked ./memory#model-offloading and #group-offloading while the zh memory page translates those headings (模型卸载 / 组卸载); using_peft_for_inference.md linked #hotswapping while the zh heading is 热切换. Repointed at the Chinese slugs. --- docs/source/zh/optimization/speed-memory-optims.md | 6 +++--- docs/source/zh/tutorials/using_peft_for_inference.md | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/source/zh/optimization/speed-memory-optims.md b/docs/source/zh/optimization/speed-memory-optims.md index 666ae863c0e1..075e3f1159dc 100644 --- a/docs/source/zh/optimization/speed-memory-optims.md +++ b/docs/source/zh/optimization/speed-memory-optims.md @@ -15,9 +15,9 @@ http://www.apache.org/licenses/LICENSE-2.0 > [!TIP] > 查看 [torch.compile](./fp16#torchcompile) 指南以了解更多关于编译以及如何在此处应用的信息。例如,区域编译可以显著减少编译时间,而不会放弃任何加速。 -对于图像生成,结合量化和[模型卸载](./memory#model-offloading)通常可以在质量、速度和内存之间提供最佳权衡。组卸载对于图像生成效果不佳,因为如果计算内核更快完成,通常不可能*完全*重叠数据传输。这会导致 CPU 和 GPU 之间的一些通信开销。 +对于图像生成,结合量化和[模型卸载](./memory#模型卸载)通常可以在质量、速度和内存之间提供最佳权衡。组卸载对于图像生成效果不佳,因为如果计算内核更快完成,通常不可能*完全*重叠数据传输。这会导致 CPU 和 GPU 之间的一些通信开销。 -对于视频生成,结合量化和[组卸载](./memory#group-offloading)往往更好,因为视频模型更受计算限制。 +对于视频生成,结合量化和[组卸载](./memory#组卸载)往往更好,因为视频模型更受计算限制。 下表提供了优化策略组合及其对 Flux 延迟和内存使用的影响的比较。 @@ -113,7 +113,7 @@ pipeline( -[组卸载](./memory#group-offloading) 将单个管道组件(如变换器模型)的内部层移动到 GPU 进行计算,并在不需要时将其卸载。同时,它使用 [CUDA 流](./memory#cuda-stream) 功能来预取下一层以执行。 +[组卸载](./memory#组卸载) 将单个管道组件(如变换器模型)的内部层移动到 GPU 进行计算,并在不需要时将其卸载。同时,它使用 [CUDA 流](./memory#cuda-stream) 功能来预取下一层以执行。 通过重叠计算和数据传输,它比模型 CPU 卸载更快,同时还能节省内存。 diff --git a/docs/source/zh/tutorials/using_peft_for_inference.md b/docs/source/zh/tutorials/using_peft_for_inference.md index 1531c4e95560..29d9df2c492a 100644 --- a/docs/source/zh/tutorials/using_peft_for_inference.md +++ b/docs/source/zh/tutorials/using_peft_for_inference.md @@ -137,7 +137,7 @@ pipeline.unet = torch.compile(pipeline.unet, mode="reduce-overhead", fullgraph=T pipeline("A bowl of ramen shaped like a cute kawaii bear").images[0] ``` -如果你想在编译模型后配合多个 LoRA 一起使用,又不想每次都重新编译,可以查看下文的 [hotswapping](#hotswapping) 部分。 +如果你想在编译模型后配合多个 LoRA 一起使用,又不想每次都重新编译,可以查看下文的 [hotswapping](#热切换) 部分。 ## 权重缩放 From f8675962f089baebfe462a537e71e9edcd0e590d Mon Sep 17 00:00:00 2001 From: simpleqt <89645338+simpleqt@users.noreply.github.com> Date: Sun, 6 Sep 2026 00:34:30 +0800 Subject: [PATCH 5/9] docs: fix PAG anchor and the StableDiffusionPipelineSafe row in the SD overview - pag.md linked #pagappliedlayers; the heading '### pag_applied_layers' keeps its underscores (#pag_applied_layers) - the SD overview table linked ./stable_diffusion_safe, a doc page that no longer exists anywhere under docs/source; the row now names the deprecated pipeline as plain text instead of a dead link --- docs/source/en/api/pipelines/pag.md | 2 +- docs/source/en/api/pipelines/stable_diffusion/overview.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/en/api/pipelines/pag.md b/docs/source/en/api/pipelines/pag.md index 96026dec06ff..4be5ffb34f50 100644 --- a/docs/source/en/api/pipelines/pag.md +++ b/docs/source/en/api/pipelines/pag.md @@ -59,7 +59,7 @@ pipeline.enable_model_cpu_offload() ``` > [!TIP] -> The `pag_applied_layers` argument allows you to specify which layers PAG is applied to. Additionally, you can use `set_pag_applied_layers` method to update these layers after the pipeline has been created. Check out the [pag_applied_layers](#pagappliedlayers) section to learn more about applying PAG to other layers. +> The `pag_applied_layers` argument allows you to specify which layers PAG is applied to. Additionally, you can use `set_pag_applied_layers` method to update these layers after the pipeline has been created. Check out the [pag_applied_layers](#pag_applied_layers) section to learn more about applying PAG to other layers. If you already have a pipeline created and loaded, you can enable PAG on it using the `from_pipe` API with the `enable_pag` flag. Internally, a PAG pipeline is created based on the pipeline and task you specified. In the example below, since we used `AutoPipelineForText2Image` and passed a `StableDiffusionXLPipeline`, a `StableDiffusionXLPAGPipeline` is created accordingly. Note that this does not require additional memory, and you will have both `StableDiffusionXLPipeline` and `StableDiffusionXLPAGPipeline` loaded and ready to use. You can read more about the `from_pipe` API and how to reuse pipelines in diffuser [here](https://huggingface.co/docs/diffusers/using-diffusers/loading#reusing-models-in-multiple-pipelines). diff --git a/docs/source/en/api/pipelines/stable_diffusion/overview.md b/docs/source/en/api/pipelines/stable_diffusion/overview.md index 2d2de39c91a8..b5ed95e9c17c 100644 --- a/docs/source/en/api/pipelines/stable_diffusion/overview.md +++ b/docs/source/en/api/pipelines/stable_diffusion/overview.md @@ -85,7 +85,7 @@ The table below summarizes the available Stable Diffusion pipelines, their suppo - StableDiffusionPipelineSafe + StableDiffusionPipelineSafe (deprecated; no doc page) filtered text-to-image From 7cf852377d4453cdbe35cac4305bfd9bffe6842e Mon Sep 17 00:00:00 2001 From: simpleqt <89645338+simpleqt@users.noreply.github.com> Date: Sun, 6 Sep 2026 00:34:23 +0800 Subject: [PATCH 6/9] docs: fix dead Masked Im2Im TOC anchors in community pipelines README The TOC rows linked #stable-diffusion-masked-im2im / #stable-diffusion-xl-masked-im2im; the actual headings are 'Masked Im2Im Stable Diffusion Pipeline' and 'Masked Im2Im Stable Diffusion Pipeline XL' (lines 3184/3219). --- examples/community/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/community/README.md b/examples/community/README.md index 67d241c153ad..f5c3357157e0 100644 --- a/examples/community/README.md +++ b/examples/community/README.md @@ -56,8 +56,8 @@ Please also check out our [Community Scripts](https://github.com/huggingface/dif | Stable Diffusion Mixture Tiling Pipeline SDXL | A pipeline generates cohesive images by integrating multiple diffusion processes, each focused on a specific image region and considering boundary effects for smooth blending | [Stable Diffusion Mixture Tiling Pipeline SDXL](#stable-diffusion-mixture-tiling-pipeline-sdxl) | [![Hugging Face Space](https://img.shields.io/badge/🤗%20Hugging%20Face-Space-yellow)](https://huggingface.co/spaces/elismasilva/mixture-of-diffusers-sdxl-tiling) | [Eliseu Silva](https://github.com/DEVAIEXP/) | | Stable Diffusion MoD ControlNet Tile SR Pipeline SDXL | This is an advanced pipeline that leverages ControlNet Tile and Mixture-of-Diffusers techniques, integrating tile diffusion directly into the latent space denoising process. Designed to overcome the limitations of conventional pixel-space tile processing, this pipeline delivers Super Resolution (SR) upscaling for higher-quality images, reduced processing time, and greater adaptability. | [Stable Diffusion MoD ControlNet Tile SR Pipeline SDXL](#stable-diffusion-mod-controlnet-tile-sr-pipeline-sdxl) | [![Hugging Face Space](https://img.shields.io/badge/🤗%20Hugging%20Face-Space-yellow)](https://huggingface.co/spaces/elismasilva/mod-control-tile-upscaler-sdxl) | [Eliseu Silva](https://github.com/DEVAIEXP/) | | FABRIC - Stable Diffusion with feedback Pipeline | pipeline supports feedback from liked and disliked images | [Stable Diffusion Fabric Pipeline](#stable-diffusion-fabric-pipeline) | [Notebook](https://github.com/huggingface/notebooks/blob/main/diffusers/stable_diffusion_fabric.ipynb)| [Shauray Singh](https://shauray8.github.io/about_shauray/) | -| sketch inpaint - Inpainting with non-inpaint Stable Diffusion | sketch inpaint much like in automatic1111 | [Masked Im2Im Stable Diffusion Pipeline](#stable-diffusion-masked-im2im) | - | [Anatoly Belikov](https://github.com/noskill) | -| sketch inpaint xl - Inpainting with non-inpaint Stable Diffusion | sketch inpaint much like in automatic1111 | [Masked Im2Im Stable Diffusion XL Pipeline](#stable-diffusion-xl-masked-im2im) | - | [Anatoly Belikov](https://github.com/noskill) | +| sketch inpaint - Inpainting with non-inpaint Stable Diffusion | sketch inpaint much like in automatic1111 | [Masked Im2Im Stable Diffusion Pipeline](#masked-im2im-stable-diffusion-pipeline) | - | [Anatoly Belikov](https://github.com/noskill) | +| sketch inpaint xl - Inpainting with non-inpaint Stable Diffusion | sketch inpaint much like in automatic1111 | [Masked Im2Im Stable Diffusion XL Pipeline](#masked-im2im-stable-diffusion-pipeline-xl) | - | [Anatoly Belikov](https://github.com/noskill) | | prompt-to-prompt | change parts of a prompt and retain image structure (see [paper page](https://prompt-to-prompt.github.io/)) | [Prompt2Prompt Pipeline](#prompt2prompt-pipeline) | [Notebook](https://github.com/huggingface/notebooks/blob/main/diffusers/prompt_2_prompt_pipeline.ipynb) | [Umer H. Adil](https://twitter.com/UmerHAdil) | | Latent Consistency Pipeline | Implementation of [Latent Consistency Models: Synthesizing High-Resolution Images with Few-Step Inference](https://huggingface.co/papers/2310.04378) | [Latent Consistency Pipeline](#latent-consistency-pipeline) | - | [Simian Luo](https://github.com/luosiallen) | | Latent Consistency Img2img Pipeline | Img2img pipeline for Latent Consistency Models | [Latent Consistency Img2Img Pipeline](#latent-consistency-img2img-pipeline) | - | [Logan Zoellner](https://github.com/nagolinc) | From e0720cf37e16060d63d85d3b17343949b0df10b2 Mon Sep 17 00:00:00 2001 From: simpleqt <89645338+simpleqt@users.noreply.github.com> Date: Tue, 8 Sep 2026 00:26:09 +0800 Subject: [PATCH 7/9] docs(examples): drop duplicated 'with' in T5/Gemma sequence-length help strings 16 example scripts' --max_sequence_length help read 'to use with with the T5 text encoder' (or the Gemma variant); surfaced in --help output. --- .../train_dreambooth_lora_flux_advanced.py | 2 +- examples/controlnet/train_controlnet_sd3.py | 2 +- examples/dreambooth/train_dreambooth_flux.py | 2 +- examples/dreambooth/train_dreambooth_lora_flux.py | 2 +- examples/dreambooth/train_dreambooth_lora_flux2.py | 2 +- examples/dreambooth/train_dreambooth_lora_flux2_img2img.py | 2 +- examples/dreambooth/train_dreambooth_lora_flux2_klein.py | 2 +- .../dreambooth/train_dreambooth_lora_flux2_klein_img2img.py | 2 +- examples/dreambooth/train_dreambooth_lora_flux_kontext.py | 2 +- examples/dreambooth/train_dreambooth_lora_lumina2.py | 2 +- examples/dreambooth/train_dreambooth_lora_sana.py | 2 +- examples/dreambooth/train_dreambooth_lora_sd3.py | 2 +- examples/dreambooth/train_dreambooth_lora_z_image.py | 2 +- examples/dreambooth/train_dreambooth_sd3.py | 2 +- examples/research_projects/sana/train_sana_sprint_diffusers.py | 2 +- .../sd3_lora_colab/train_dreambooth_lora_sd3_miniature.py | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/examples/advanced_diffusion_training/train_dreambooth_lora_flux_advanced.py b/examples/advanced_diffusion_training/train_dreambooth_lora_flux_advanced.py index 3c7015458c8d..318db82661cc 100644 --- a/examples/advanced_diffusion_training/train_dreambooth_lora_flux_advanced.py +++ b/examples/advanced_diffusion_training/train_dreambooth_lora_flux_advanced.py @@ -421,7 +421,7 @@ def parse_args(input_args=None): "--max_sequence_length", type=int, default=512, - help="Maximum sequence length to use with with the T5 text encoder", + help="Maximum sequence length to use with the T5 text encoder", ) parser.add_argument( "--validation_prompt", diff --git a/examples/controlnet/train_controlnet_sd3.py b/examples/controlnet/train_controlnet_sd3.py index fc2111db386b..e0e296bacb7f 100644 --- a/examples/controlnet/train_controlnet_sd3.py +++ b/examples/controlnet/train_controlnet_sd3.py @@ -585,7 +585,7 @@ def parse_args(input_args=None): "--max_sequence_length", type=int, default=77, - help="Maximum sequence length to use with with the T5 text encoder", + help="Maximum sequence length to use with the T5 text encoder", ) parser.add_argument( "--dataset_preprocess_batch_size", type=int, default=1000, help="Batch size for preprocessing dataset." diff --git a/examples/dreambooth/train_dreambooth_flux.py b/examples/dreambooth/train_dreambooth_flux.py index df3e03e70d44..ffaa7de1ad86 100644 --- a/examples/dreambooth/train_dreambooth_flux.py +++ b/examples/dreambooth/train_dreambooth_flux.py @@ -329,7 +329,7 @@ def parse_args(input_args=None): "--max_sequence_length", type=int, default=77, - help="Maximum sequence length to use with with the T5 text encoder", + help="Maximum sequence length to use with the T5 text encoder", ) parser.add_argument( "--validation_prompt", diff --git a/examples/dreambooth/train_dreambooth_lora_flux.py b/examples/dreambooth/train_dreambooth_lora_flux.py index 9bae56da2377..3375a583e2f2 100644 --- a/examples/dreambooth/train_dreambooth_lora_flux.py +++ b/examples/dreambooth/train_dreambooth_lora_flux.py @@ -349,7 +349,7 @@ def parse_args(input_args=None): "--max_sequence_length", type=int, default=512, - help="Maximum sequence length to use with with the T5 text encoder", + help="Maximum sequence length to use with the T5 text encoder", ) parser.add_argument( "--validation_prompt", diff --git a/examples/dreambooth/train_dreambooth_lora_flux2.py b/examples/dreambooth/train_dreambooth_lora_flux2.py index 8cb5437c7093..85faea833bb9 100644 --- a/examples/dreambooth/train_dreambooth_lora_flux2.py +++ b/examples/dreambooth/train_dreambooth_lora_flux2.py @@ -353,7 +353,7 @@ def parse_args(input_args=None): "--max_sequence_length", type=int, default=512, - help="Maximum sequence length to use with with the T5 text encoder", + help="Maximum sequence length to use with the T5 text encoder", ) parser.add_argument( "--text_encoder_out_layers", diff --git a/examples/dreambooth/train_dreambooth_lora_flux2_img2img.py b/examples/dreambooth/train_dreambooth_lora_flux2_img2img.py index 7397c2abef98..2ba694405c48 100644 --- a/examples/dreambooth/train_dreambooth_lora_flux2_img2img.py +++ b/examples/dreambooth/train_dreambooth_lora_flux2_img2img.py @@ -354,7 +354,7 @@ def parse_args(input_args=None): "--max_sequence_length", type=int, default=512, - help="Maximum sequence length to use with with the T5 text encoder", + help="Maximum sequence length to use with the T5 text encoder", ) parser.add_argument( "--validation_prompt", diff --git a/examples/dreambooth/train_dreambooth_lora_flux2_klein.py b/examples/dreambooth/train_dreambooth_lora_flux2_klein.py index 684e123c6e55..3cad3f2ac561 100644 --- a/examples/dreambooth/train_dreambooth_lora_flux2_klein.py +++ b/examples/dreambooth/train_dreambooth_lora_flux2_klein.py @@ -353,7 +353,7 @@ def parse_args(input_args=None): "--max_sequence_length", type=int, default=512, - help="Maximum sequence length to use with with the T5 text encoder", + help="Maximum sequence length to use with the T5 text encoder", ) parser.add_argument( "--text_encoder_out_layers", diff --git a/examples/dreambooth/train_dreambooth_lora_flux2_klein_img2img.py b/examples/dreambooth/train_dreambooth_lora_flux2_klein_img2img.py index f3ab6916193e..df56f2557213 100644 --- a/examples/dreambooth/train_dreambooth_lora_flux2_klein_img2img.py +++ b/examples/dreambooth/train_dreambooth_lora_flux2_klein_img2img.py @@ -355,7 +355,7 @@ def parse_args(input_args=None): "--max_sequence_length", type=int, default=512, - help="Maximum sequence length to use with with the T5 text encoder", + help="Maximum sequence length to use with the T5 text encoder", ) parser.add_argument( "--validation_prompt", diff --git a/examples/dreambooth/train_dreambooth_lora_flux_kontext.py b/examples/dreambooth/train_dreambooth_lora_flux_kontext.py index 6884cc58ea5e..f2e8e931b5dd 100644 --- a/examples/dreambooth/train_dreambooth_lora_flux_kontext.py +++ b/examples/dreambooth/train_dreambooth_lora_flux_kontext.py @@ -368,7 +368,7 @@ def parse_args(input_args=None): "--max_sequence_length", type=int, default=512, - help="Maximum sequence length to use with with the T5 text encoder", + help="Maximum sequence length to use with the T5 text encoder", ) parser.add_argument( "--validation_prompt", diff --git a/examples/dreambooth/train_dreambooth_lora_lumina2.py b/examples/dreambooth/train_dreambooth_lora_lumina2.py index 9932f3dfd878..f786b62fbecc 100644 --- a/examples/dreambooth/train_dreambooth_lora_lumina2.py +++ b/examples/dreambooth/train_dreambooth_lora_lumina2.py @@ -288,7 +288,7 @@ def parse_args(input_args=None): "--max_sequence_length", type=int, default=256, - help="Maximum sequence length to use with with the Gemma2 model", + help="Maximum sequence length to use with the Gemma2 model", ) parser.add_argument( "--system_prompt", diff --git a/examples/dreambooth/train_dreambooth_lora_sana.py b/examples/dreambooth/train_dreambooth_lora_sana.py index 4e70d6ab1b92..7b79d33496a2 100644 --- a/examples/dreambooth/train_dreambooth_lora_sana.py +++ b/examples/dreambooth/train_dreambooth_lora_sana.py @@ -308,7 +308,7 @@ def parse_args(input_args=None): "--max_sequence_length", type=int, default=300, - help="Maximum sequence length to use with with the Gemma model", + help="Maximum sequence length to use with the Gemma model", ) parser.add_argument( "--complex_human_instruction", diff --git a/examples/dreambooth/train_dreambooth_lora_sd3.py b/examples/dreambooth/train_dreambooth_lora_sd3.py index a1b3e34106d4..6f5c61781f89 100644 --- a/examples/dreambooth/train_dreambooth_lora_sd3.py +++ b/examples/dreambooth/train_dreambooth_lora_sd3.py @@ -339,7 +339,7 @@ def parse_args(input_args=None): "--max_sequence_length", type=int, default=77, - help="Maximum sequence length to use with with the T5 text encoder", + help="Maximum sequence length to use with the T5 text encoder", ) parser.add_argument( "--validation_prompt", diff --git a/examples/dreambooth/train_dreambooth_lora_z_image.py b/examples/dreambooth/train_dreambooth_lora_z_image.py index ef2f6870df30..e116803ee859 100644 --- a/examples/dreambooth/train_dreambooth_lora_z_image.py +++ b/examples/dreambooth/train_dreambooth_lora_z_image.py @@ -353,7 +353,7 @@ def parse_args(input_args=None): "--max_sequence_length", type=int, default=512, - help="Maximum sequence length to use with with the T5 text encoder", + help="Maximum sequence length to use with the T5 text encoder", ) parser.add_argument( diff --git a/examples/dreambooth/train_dreambooth_sd3.py b/examples/dreambooth/train_dreambooth_sd3.py index 2151cd009a42..7419d8763756 100644 --- a/examples/dreambooth/train_dreambooth_sd3.py +++ b/examples/dreambooth/train_dreambooth_sd3.py @@ -315,7 +315,7 @@ def parse_args(input_args=None): "--max_sequence_length", type=int, default=77, - help="Maximum sequence length to use with with the T5 text encoder", + help="Maximum sequence length to use with the T5 text encoder", ) parser.add_argument( "--validation_prompt", diff --git a/examples/research_projects/sana/train_sana_sprint_diffusers.py b/examples/research_projects/sana/train_sana_sprint_diffusers.py index d127fee5fd0d..bd164ea2119e 100644 --- a/examples/research_projects/sana/train_sana_sprint_diffusers.py +++ b/examples/research_projects/sana/train_sana_sprint_diffusers.py @@ -359,7 +359,7 @@ def parse_args(input_args=None): "--max_sequence_length", type=int, default=300, - help="Maximum sequence length to use with with the Gemma model", + help="Maximum sequence length to use with the Gemma model", ) parser.add_argument( "--validation_prompt", diff --git a/examples/research_projects/sd3_lora_colab/train_dreambooth_lora_sd3_miniature.py b/examples/research_projects/sd3_lora_colab/train_dreambooth_lora_sd3_miniature.py index d73aab73630a..63b8e194f620 100644 --- a/examples/research_projects/sd3_lora_colab/train_dreambooth_lora_sd3_miniature.py +++ b/examples/research_projects/sd3_lora_colab/train_dreambooth_lora_sd3_miniature.py @@ -235,7 +235,7 @@ def parse_args(input_args=None): "--max_sequence_length", type=int, default=77, - help="Maximum sequence length to use with with the T5 text encoder", + help="Maximum sequence length to use with the T5 text encoder", ) parser.add_argument( "--validation_prompt", From 7cded81aae817bd36f5e0206480fda915b4598bd Mon Sep 17 00:00:00 2001 From: simpleqt <89645338+simpleqt@users.noreply.github.com> Date: Wed, 16 Sep 2026 18:47:26 +0800 Subject: [PATCH 8/9] fix(links): keep the pag_applied_layers anchor in doc-builder form MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit doc-builder slugifies headings by dropping underscores, so the heading '### pag_applied_layers' anchors as #pagappliedlayers — the form the check-links CI expects. GitHub-style underscores broke it. Signed-off-by: simpleqt <89645338+simpleqt@users.noreply.github.com> --- docs/source/en/api/pipelines/pag.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/en/api/pipelines/pag.md b/docs/source/en/api/pipelines/pag.md index 4be5ffb34f50..96026dec06ff 100644 --- a/docs/source/en/api/pipelines/pag.md +++ b/docs/source/en/api/pipelines/pag.md @@ -59,7 +59,7 @@ pipeline.enable_model_cpu_offload() ``` > [!TIP] -> The `pag_applied_layers` argument allows you to specify which layers PAG is applied to. Additionally, you can use `set_pag_applied_layers` method to update these layers after the pipeline has been created. Check out the [pag_applied_layers](#pag_applied_layers) section to learn more about applying PAG to other layers. +> The `pag_applied_layers` argument allows you to specify which layers PAG is applied to. Additionally, you can use `set_pag_applied_layers` method to update these layers after the pipeline has been created. Check out the [pag_applied_layers](#pagappliedlayers) section to learn more about applying PAG to other layers. If you already have a pipeline created and loaded, you can enable PAG on it using the `from_pipe` API with the `enable_pag` flag. Internally, a PAG pipeline is created based on the pipeline and task you specified. In the example below, since we used `AutoPipelineForText2Image` and passed a `StableDiffusionXLPipeline`, a `StableDiffusionXLPAGPipeline` is created accordingly. Note that this does not require additional memory, and you will have both `StableDiffusionXLPipeline` and `StableDiffusionXLPAGPipeline` loaded and ready to use. You can read more about the `from_pipe` API and how to reuse pipelines in diffuser [here](https://huggingface.co/docs/diffusers/using-diffusers/loading#reusing-models-in-multiple-pipelines). From 41cf1a6949a96ca1dde06b9e1dee9cc4742e2417 Mon Sep 17 00:00:00 2001 From: simpleqt <89645338+simpleqt@users.noreply.github.com> Date: Thu, 17 Sep 2026 23:49:03 +0800 Subject: [PATCH 9/9] fix(kandinsky5): recompute prompt_template_encode_start_idx after the promt fix Correcting 'promt' -> 'prompt' in the system templates shifts each template's token count by one (verified with the Qwen2.5-VL tokenizer: 41->40, 55->54, 129->128, 129->128). Without this, the hardcoded start indices slice the encoded prompt one token off. --- src/diffusers/pipelines/kandinsky5/pipeline_kandinsky.py | 2 +- src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_i2i.py | 2 +- src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_i2v.py | 2 +- src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_t2i.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky.py b/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky.py index 56098a0a7550..7a5dc2cd1ac1 100644 --- a/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky.py +++ b/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky.py @@ -198,7 +198,7 @@ def __init__( "<|im_start|>user\n{}<|im_end|>", ] ) - self.prompt_template_encode_start_idx = 129 + self.prompt_template_encode_start_idx = 128 self.vae_scale_factor_temporal = ( self.vae.config.temporal_compression_ratio if getattr(self, "vae", None) else 4 diff --git a/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_i2i.py b/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_i2i.py index 507991374dd2..1784b4e42972 100644 --- a/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_i2i.py +++ b/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_i2i.py @@ -175,7 +175,7 @@ def __init__( scheduler=scheduler, ) self.prompt_template = "<|im_start|>system\nYou are a prompt engineer. Based on the provided source image (first image) and target image (second image), create an interesting text prompt that can be used together with the source image to create the target image:<|im_end|><|im_start|>user{}<|vision_start|><|image_pad|><|vision_end|><|im_end|>" - self.prompt_template_encode_start_idx = 55 + self.prompt_template_encode_start_idx = 54 self.vae_scale_factor_spatial = 8 self.image_processor = VaeImageProcessor(vae_scale_factor=self.vae_scale_factor_spatial) diff --git a/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_i2v.py b/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_i2v.py index d5bfe362a83c..d39478547d8e 100644 --- a/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_i2v.py +++ b/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_i2v.py @@ -195,7 +195,7 @@ def __init__( "<|im_start|>user\n{}<|im_end|>", ] ) - self.prompt_template_encode_start_idx = 129 + self.prompt_template_encode_start_idx = 128 self.vae_scale_factor_temporal = ( self.vae.config.temporal_compression_ratio if getattr(self, "vae", None) else 4 diff --git a/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_t2i.py b/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_t2i.py index c39f9c1b3333..d86fff668771 100644 --- a/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_t2i.py +++ b/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_t2i.py @@ -176,7 +176,7 @@ def __init__( ) self.prompt_template = "<|im_start|>system\nYou are a prompt engineer. Describe the image by detailing the color, shape, size, texture, quantity, text, spatial relationships of the objects and background:<|im_end|>\n<|im_start|>user\n{}<|im_end|>" - self.prompt_template_encode_start_idx = 41 + self.prompt_template_encode_start_idx = 40 self.vae_scale_factor_spatial = 8 self.image_processor = VaeImageProcessor(vae_scale_factor=self.vae_scale_factor_spatial)