Datasets:

ArXiv:
diffusers-benchmarking-bot commited on
Commit
c26dbbe
·
verified ·
1 Parent(s): 5bca759

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. main/README.md +8 -8
  2. main/mixture_tiling_sdxl.py +59 -7
main/README.md CHANGED
@@ -50,8 +50,9 @@ Please also check out our [Community Scripts](https://github.com/huggingface/dif
50
  | IADB Pipeline | Implementation of [Iterative α-(de)Blending: a Minimalist Deterministic Diffusion Model](https://arxiv.org/abs/2305.03486) | [IADB Pipeline](#iadb-pipeline) | - | [Thomas Chambon](https://github.com/tchambon)
51
  | Zero1to3 Pipeline | Implementation of [Zero-1-to-3: Zero-shot One Image to 3D Object](https://arxiv.org/abs/2303.11328) | [Zero1to3 Pipeline](#zero1to3-pipeline) | - | [Xin Kong](https://github.com/kxhit) |
52
  | Stable Diffusion XL Long Weighted Prompt Pipeline | A pipeline support unlimited length of prompt and negative prompt, use A1111 style of prompt weighting | [Stable Diffusion XL Long Weighted Prompt Pipeline](#stable-diffusion-xl-long-weighted-prompt-pipeline) | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1LsqilswLR40XLLcp6XFOl5nKb_wOe26W?usp=sharing) | [Andrew Zhu](https://xhinker.medium.com/) |
53
- | Stable Diffusion Mixture Tiling Pipeline SD 1.5 | 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 SD 1.5](#stable-diffusion-mixture-tiling-sd-15) | [![Hugging Face Space](https://img.shields.io/badge/🤗%20Hugging%20Face-Space-yellow)](https://huggingface.co/spaces/albarji/mixture-of-diffusers) | [Álvaro B Jiménez](https://github.com/albarji/) |
54
- | 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-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/) |
 
55
  | 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/) |
56
  | 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) |
57
  | 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) |
@@ -2404,7 +2405,7 @@ pipe_images = mixing_pipeline(
2404
 
2405
  ![image_mixing_result](https://huggingface.co/datasets/TheDenk/images_mixing/resolve/main/boromir_gigachad.png)
2406
 
2407
- ### Stable Diffusion Mixture Tiling SD 1.5
2408
 
2409
  This pipeline uses the Mixture. Refer to the [Mixture](https://arxiv.org/abs/2302.02412) paper for more details.
2410
 
@@ -2435,7 +2436,7 @@ image = pipeline(
2435
 
2436
  ![mixture_tiling_results](https://huggingface.co/datasets/kadirnar/diffusers_readme_images/resolve/main/mixture_tiling.png)
2437
 
2438
- ### Stable Diffusion Mixture Canvas
2439
 
2440
  This pipeline uses the Mixture. Refer to the [Mixture](https://arxiv.org/abs/2302.02412) paper for more details.
2441
 
@@ -2470,7 +2471,7 @@ output = pipeline(
2470
  ![Input_Image](https://huggingface.co/datasets/kadirnar/diffusers_readme_images/resolve/main/input_image.png)
2471
  ![mixture_canvas_results](https://huggingface.co/datasets/kadirnar/diffusers_readme_images/resolve/main/canvas.png)
2472
 
2473
- ### Stable Diffusion Mixture Tiling SDXL
2474
 
2475
  This pipeline uses the Mixture. Refer to the [Mixture](https://arxiv.org/abs/2302.02412) paper for more details.
2476
 
@@ -2516,14 +2517,13 @@ image = pipe(
2516
  tile_col_overlap=256,
2517
  guidance_scale_tiles=[[7, 7, 7]], # or guidance_scale=7 if is the same for all prompts
2518
  height=1024,
2519
- width=3840,
2520
- target_size=(1024, 3840),
2521
  generator=generator,
2522
  num_inference_steps=30,
2523
  )["images"][0]
2524
  ```
2525
 
2526
- ![mixture_tiling_results](https://huggingface.co/datasets/elismasilva/results/resolve/main/mixture_sdxl.png)
2527
 
2528
  ### TensorRT Inpainting Stable Diffusion Pipeline
2529
 
 
50
  | IADB Pipeline | Implementation of [Iterative α-(de)Blending: a Minimalist Deterministic Diffusion Model](https://arxiv.org/abs/2305.03486) | [IADB Pipeline](#iadb-pipeline) | - | [Thomas Chambon](https://github.com/tchambon)
51
  | Zero1to3 Pipeline | Implementation of [Zero-1-to-3: Zero-shot One Image to 3D Object](https://arxiv.org/abs/2303.11328) | [Zero1to3 Pipeline](#zero1to3-pipeline) | - | [Xin Kong](https://github.com/kxhit) |
52
  | Stable Diffusion XL Long Weighted Prompt Pipeline | A pipeline support unlimited length of prompt and negative prompt, use A1111 style of prompt weighting | [Stable Diffusion XL Long Weighted Prompt Pipeline](#stable-diffusion-xl-long-weighted-prompt-pipeline) | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1LsqilswLR40XLLcp6XFOl5nKb_wOe26W?usp=sharing) | [Andrew Zhu](https://xhinker.medium.com/) |
53
+ | Stable Diffusion Mixture Tiling Pipeline SD 1.5 | 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 SD 1.5](#stable-diffusion-mixture-tiling-pipeline-sd-15) | [![Hugging Face Space](https://img.shields.io/badge/🤗%20Hugging%20Face-Space-yellow)](https://huggingface.co/spaces/albarji/mixture-of-diffusers) | [Álvaro B Jiménez](https://github.com/albarji/) |
54
+ | Stable Diffusion Mixture Canvas Pipeline SD 1.5 | A pipeline generates cohesive images by integrating multiple diffusion processes, each focused on a specific image region and considering boundary effects for smooth blending. Works by defining a list of Text2Image region objects that detail the region of influence of each diffuser. | [Stable Diffusion Mixture Canvas Pipeline SD 1.5](#stable-diffusion-mixture-canvas-pipeline-sd-15) | [![Hugging Face Space](https://img.shields.io/badge/🤗%20Hugging%20Face-Space-yellow)](https://huggingface.co/spaces/albarji/mixture-of-diffusers) | [Álvaro B Jiménez](https://github.com/albarji/) |
55
+ | 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/) |
56
  | 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/) |
57
  | 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) |
58
  | 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) |
 
2405
 
2406
  ![image_mixing_result](https://huggingface.co/datasets/TheDenk/images_mixing/resolve/main/boromir_gigachad.png)
2407
 
2408
+ ### Stable Diffusion Mixture Tiling Pipeline SD 1.5
2409
 
2410
  This pipeline uses the Mixture. Refer to the [Mixture](https://arxiv.org/abs/2302.02412) paper for more details.
2411
 
 
2436
 
2437
  ![mixture_tiling_results](https://huggingface.co/datasets/kadirnar/diffusers_readme_images/resolve/main/mixture_tiling.png)
2438
 
2439
+ ### Stable Diffusion Mixture Canvas Pipeline SD 1.5
2440
 
2441
  This pipeline uses the Mixture. Refer to the [Mixture](https://arxiv.org/abs/2302.02412) paper for more details.
2442
 
 
2471
  ![Input_Image](https://huggingface.co/datasets/kadirnar/diffusers_readme_images/resolve/main/input_image.png)
2472
  ![mixture_canvas_results](https://huggingface.co/datasets/kadirnar/diffusers_readme_images/resolve/main/canvas.png)
2473
 
2474
+ ### Stable Diffusion Mixture Tiling Pipeline SDXL
2475
 
2476
  This pipeline uses the Mixture. Refer to the [Mixture](https://arxiv.org/abs/2302.02412) paper for more details.
2477
 
 
2517
  tile_col_overlap=256,
2518
  guidance_scale_tiles=[[7, 7, 7]], # or guidance_scale=7 if is the same for all prompts
2519
  height=1024,
2520
+ width=3840,
 
2521
  generator=generator,
2522
  num_inference_steps=30,
2523
  )["images"][0]
2524
  ```
2525
 
2526
+ ![mixture_tiling_results](https://huggingface.co/datasets/elismasilva/results/resolve/main/mixture_of_diffusers_sdxl_1.png)
2527
 
2528
  ### TensorRT Inpainting Stable Diffusion Pipeline
2529
 
main/mixture_tiling_sdxl.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright 2024 The HuggingFace Team. All rights reserved.
2
  #
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
  # you may not use this file except in compliance with the License.
@@ -151,6 +151,51 @@ def _tile2latent_exclusive_indices(
151
  return row_segment[0], row_segment[1], col_segment[0], col_segment[1]
152
 
153
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
  # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.rescale_noise_cfg
155
  def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
156
  r"""
@@ -757,10 +802,10 @@ class StableDiffusionXLTilingPipeline(
757
  return_dict: bool = True,
758
  cross_attention_kwargs: Optional[Dict[str, Any]] = None,
759
  original_size: Optional[Tuple[int, int]] = None,
760
- crops_coords_top_left: Tuple[int, int] = (0, 0),
761
  target_size: Optional[Tuple[int, int]] = None,
762
  negative_original_size: Optional[Tuple[int, int]] = None,
763
- negative_crops_coords_top_left: Tuple[int, int] = (0, 0),
764
  negative_target_size: Optional[Tuple[int, int]] = None,
765
  clip_skip: Optional[int] = None,
766
  tile_height: Optional[int] = 1024,
@@ -826,7 +871,7 @@ class StableDiffusionXLTilingPipeline(
826
  `original_size` defaults to `(height, width)` if not specified. Part of SDXL's micro-conditioning as
827
  explained in section 2.2 of
828
  [https://huggingface.co/papers/2307.01952](https://huggingface.co/papers/2307.01952).
829
- crops_coords_top_left (`Tuple[int]`, *optional*, defaults to (0, 0)):
830
  `crops_coords_top_left` can be used to generate an image that appears to be "cropped" from the position
831
  `crops_coords_top_left` downwards. Favorable, well-centered images are usually achieved by setting
832
  `crops_coords_top_left` to (0, 0). Part of SDXL's micro-conditioning as explained in section 2.2 of
@@ -840,7 +885,7 @@ class StableDiffusionXLTilingPipeline(
840
  micro-conditioning as explained in section 2.2 of
841
  [https://huggingface.co/papers/2307.01952](https://huggingface.co/papers/2307.01952). For more
842
  information, refer to this issue thread: https://github.com/huggingface/diffusers/issues/4208.
843
- negative_crops_coords_top_left (`Tuple[int]`, *optional*, defaults to (0, 0)):
844
  To negatively condition the generation process based on a specific crop coordinates. Part of SDXL's
845
  micro-conditioning as explained in section 2.2 of
846
  [https://huggingface.co/papers/2307.01952](https://huggingface.co/papers/2307.01952). For more
@@ -883,6 +928,8 @@ class StableDiffusionXLTilingPipeline(
883
 
884
  original_size = original_size or (height, width)
885
  target_size = target_size or (height, width)
 
 
886
 
887
  self._guidance_scale = guidance_scale
888
  self._clip_skip = clip_skip
@@ -914,6 +961,11 @@ class StableDiffusionXLTilingPipeline(
914
 
915
  device = self._execution_device
916
 
 
 
 
 
 
917
  # update height and width tile size and tile overlap size
918
  height = tile_height + (grid_rows - 1) * (tile_height - tile_row_overlap)
919
  width = tile_width + (grid_cols - 1) * (tile_width - tile_col_overlap)
@@ -1020,7 +1072,7 @@ class StableDiffusionXLTilingPipeline(
1020
  text_encoder_projection_dim = self.text_encoder_2.config.projection_dim
1021
  add_time_ids = self._get_add_time_ids(
1022
  original_size,
1023
- crops_coords_top_left,
1024
  target_size,
1025
  dtype=prompt_embeds.dtype,
1026
  text_encoder_projection_dim=text_encoder_projection_dim,
@@ -1028,7 +1080,7 @@ class StableDiffusionXLTilingPipeline(
1028
  if negative_original_size is not None and negative_target_size is not None:
1029
  negative_add_time_ids = self._get_add_time_ids(
1030
  negative_original_size,
1031
- negative_crops_coords_top_left,
1032
  negative_target_size,
1033
  dtype=prompt_embeds.dtype,
1034
  text_encoder_projection_dim=text_encoder_projection_dim,
 
1
+ # Copyright 2025 The HuggingFace Team. All rights reserved.
2
  #
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
  # you may not use this file except in compliance with the License.
 
151
  return row_segment[0], row_segment[1], col_segment[0], col_segment[1]
152
 
153
 
154
+ def _get_crops_coords_list(num_rows, num_cols, output_width):
155
+ """
156
+ Generates a list of lists of `crops_coords_top_left` tuples for focusing on
157
+ different horizontal parts of an image, and repeats this list for the specified
158
+ number of rows in the output structure.
159
+
160
+ This function calculates `crops_coords_top_left` tuples to create horizontal
161
+ focus variations (like left, center, right focus) based on `output_width`
162
+ and `num_cols` (which represents the number of horizontal focus points/columns).
163
+ It then repeats the *list* of these horizontal focus tuples `num_rows` times to
164
+ create the final list of lists output structure.
165
+
166
+ Args:
167
+ num_rows (int): The desired number of rows in the output list of lists.
168
+ This determines how many times the list of horizontal
169
+ focus variations will be repeated.
170
+ num_cols (int): The number of horizontal focus points (columns) to generate.
171
+ This determines how many horizontal focus variations are
172
+ created based on dividing the `output_width`.
173
+ output_width (int): The desired width of the output image.
174
+
175
+ Returns:
176
+ list[list[tuple[int, int]]]: A list of lists of tuples. Each inner list
177
+ contains `num_cols` tuples of `(ctop, cleft)`,
178
+ representing horizontal focus points. The outer list
179
+ contains `num_rows` such inner lists.
180
+ """
181
+ crops_coords_list = []
182
+ if num_cols <= 0:
183
+ crops_coords_list = []
184
+ elif num_cols == 1:
185
+ crops_coords_list = [(0, 0)]
186
+ else:
187
+ section_width = output_width / num_cols
188
+ for i in range(num_cols):
189
+ cleft = int(round(i * section_width))
190
+ crops_coords_list.append((0, cleft))
191
+
192
+ result_list = []
193
+ for _ in range(num_rows):
194
+ result_list.append(list(crops_coords_list))
195
+
196
+ return result_list
197
+
198
+
199
  # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.rescale_noise_cfg
200
  def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
201
  r"""
 
802
  return_dict: bool = True,
803
  cross_attention_kwargs: Optional[Dict[str, Any]] = None,
804
  original_size: Optional[Tuple[int, int]] = None,
805
+ crops_coords_top_left: Optional[List[List[Tuple[int, int]]]] = None,
806
  target_size: Optional[Tuple[int, int]] = None,
807
  negative_original_size: Optional[Tuple[int, int]] = None,
808
+ negative_crops_coords_top_left: Optional[List[List[Tuple[int, int]]]] = None,
809
  negative_target_size: Optional[Tuple[int, int]] = None,
810
  clip_skip: Optional[int] = None,
811
  tile_height: Optional[int] = 1024,
 
871
  `original_size` defaults to `(height, width)` if not specified. Part of SDXL's micro-conditioning as
872
  explained in section 2.2 of
873
  [https://huggingface.co/papers/2307.01952](https://huggingface.co/papers/2307.01952).
874
+ crops_coords_top_left (`List[List[Tuple[int, int]]]`, *optional*, defaults to (0, 0)):
875
  `crops_coords_top_left` can be used to generate an image that appears to be "cropped" from the position
876
  `crops_coords_top_left` downwards. Favorable, well-centered images are usually achieved by setting
877
  `crops_coords_top_left` to (0, 0). Part of SDXL's micro-conditioning as explained in section 2.2 of
 
885
  micro-conditioning as explained in section 2.2 of
886
  [https://huggingface.co/papers/2307.01952](https://huggingface.co/papers/2307.01952). For more
887
  information, refer to this issue thread: https://github.com/huggingface/diffusers/issues/4208.
888
+ negative_crops_coords_top_left (`List[List[Tuple[int, int]]]`, *optional*, defaults to (0, 0)):
889
  To negatively condition the generation process based on a specific crop coordinates. Part of SDXL's
890
  micro-conditioning as explained in section 2.2 of
891
  [https://huggingface.co/papers/2307.01952](https://huggingface.co/papers/2307.01952). For more
 
928
 
929
  original_size = original_size or (height, width)
930
  target_size = target_size or (height, width)
931
+ negative_original_size = negative_original_size or (height, width)
932
+ negative_target_size = negative_target_size or (height, width)
933
 
934
  self._guidance_scale = guidance_scale
935
  self._clip_skip = clip_skip
 
961
 
962
  device = self._execution_device
963
 
964
+ # update crops coords list
965
+ crops_coords_top_left = _get_crops_coords_list(grid_rows, grid_cols, tile_width)
966
+ if negative_original_size is not None and negative_target_size is not None:
967
+ negative_crops_coords_top_left = _get_crops_coords_list(grid_rows, grid_cols, tile_width)
968
+
969
  # update height and width tile size and tile overlap size
970
  height = tile_height + (grid_rows - 1) * (tile_height - tile_row_overlap)
971
  width = tile_width + (grid_cols - 1) * (tile_width - tile_col_overlap)
 
1072
  text_encoder_projection_dim = self.text_encoder_2.config.projection_dim
1073
  add_time_ids = self._get_add_time_ids(
1074
  original_size,
1075
+ crops_coords_top_left[row][col],
1076
  target_size,
1077
  dtype=prompt_embeds.dtype,
1078
  text_encoder_projection_dim=text_encoder_projection_dim,
 
1080
  if negative_original_size is not None and negative_target_size is not None:
1081
  negative_add_time_ids = self._get_add_time_ids(
1082
  negative_original_size,
1083
+ negative_crops_coords_top_left[row][col],
1084
  negative_target_size,
1085
  dtype=prompt_embeds.dtype,
1086
  text_encoder_projection_dim=text_encoder_projection_dim,