Skip to content

Commit be8bf68

Browse files
authored
Merge branch 'main' into pipeline-without-unet
2 parents 7defb84 + 7116fd2 commit be8bf68

File tree

185 files changed

+2222
-946
lines changed

Some content is hidden

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

185 files changed

+2222
-946
lines changed

.github/workflows/nightly_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ jobs:
272272
python -m pytest -n 1 --max-worker-restart=0 --dist=loadfile \
273273
-s -v -k "not Flax and not Onnx" \
274274
--make-reports=tests_torch_minimum_version_cuda \
275-
tests/models/test_modelling_common.py \
275+
tests/models/test_modeling_common.py \
276276
tests/pipelines/test_pipelines_common.py \
277277
tests/pipelines/test_pipeline_utils.py \
278278
tests/pipelines/test_pipelines.py \

.github/workflows/pr_tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ jobs:
266266
# TODO (sayakpaul, DN6): revisit `--no-deps`
267267
python -m pip install -U peft@git+https://github.com/huggingface/peft.git --no-deps
268268
python -m uv pip install -U transformers@git+https://github.com/huggingface/transformers.git --no-deps
269+
python -m uv pip install -U tokenizers
269270
pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git --no-deps
270271
271272
- name: Environment

.github/workflows/release_tests_fast.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ jobs:
193193
python -m pytest -n 1 --max-worker-restart=0 --dist=loadfile \
194194
-s -v -k "not Flax and not Onnx" \
195195
--make-reports=tests_torch_minimum_cuda \
196-
tests/models/test_modelling_common.py \
196+
tests/models/test_modeling_common.py \
197197
tests/pipelines/test_pipelines_common.py \
198198
tests/pipelines/test_pipeline_utils.py \
199199
tests/pipelines/test_pipelines.py \

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,33 @@ image = pipeline(prompt).images[0]
6262
image.save("auraflow.png")
6363
```
6464

65+
Loading [GGUF checkpoints](https://huggingface.co/docs/diffusers/quantization/gguf) are also supported:
66+
67+
```py
68+
import torch
69+
from diffusers import (
70+
AuraFlowPipeline,
71+
GGUFQuantizationConfig,
72+
AuraFlowTransformer2DModel,
73+
)
74+
75+
transformer = AuraFlowTransformer2DModel.from_single_file(
76+
"https://huggingface.co/city96/AuraFlow-v0.3-gguf/blob/main/aura_flow_0.3-Q2_K.gguf",
77+
quantization_config=GGUFQuantizationConfig(compute_dtype=torch.bfloat16),
78+
torch_dtype=torch.bfloat16,
79+
)
80+
81+
pipeline = AuraFlowPipeline.from_pretrained(
82+
"fal/AuraFlow-v0.3",
83+
transformer=transformer,
84+
torch_dtype=torch.bfloat16,
85+
)
86+
87+
prompt = "a cute pony in a field of flowers"
88+
image = pipeline(prompt).images[0]
89+
image.save("auraflow.png")
90+
```
91+
6592
## AuraFlowPipeline
6693

6794
[[autodoc]] AuraFlowPipeline

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ Refer to the [Quantization](../../quantization/overview) overview to learn more
5959
```py
6060
import torch
6161
from diffusers import BitsAndBytesConfig as DiffusersBitsAndBytesConfig, SanaTransformer2DModel, SanaPipeline
62-
from transformers import BitsAndBytesConfig as BitsAndBytesConfig, AutoModelForCausalLM
62+
from transformers import BitsAndBytesConfig as BitsAndBytesConfig, AutoModel
6363

6464
quant_config = BitsAndBytesConfig(load_in_8bit=True)
65-
text_encoder_8bit = AutoModelForCausalLM.from_pretrained(
65+
text_encoder_8bit = AutoModel.from_pretrained(
6666
"Efficient-Large-Model/Sana_1600M_1024px_diffusers",
6767
subfolder="text_encoder",
6868
quantization_config=quant_config,

examples/community/README.md

Lines changed: 5 additions & 5 deletions
Large diffs are not rendered by default.

examples/community/lpw_stable_diffusion_xl.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,9 @@ def encode_prompt(
831831
)
832832

833833
# We are only ALWAYS interested in the pooled output of the final text encoder
834-
pooled_prompt_embeds = prompt_embeds[0]
834+
if pooled_prompt_embeds is None and prompt_embeds[0].ndim == 2:
835+
pooled_prompt_embeds = prompt_embeds[0]
836+
835837
prompt_embeds = prompt_embeds.hidden_states[-2]
836838

837839
prompt_embeds_list.append(prompt_embeds)
@@ -883,7 +885,8 @@ def encode_prompt(
883885
output_hidden_states=True,
884886
)
885887
# We are only ALWAYS interested in the pooled output of the final text encoder
886-
negative_pooled_prompt_embeds = negative_prompt_embeds[0]
888+
if negative_pooled_prompt_embeds is None and negative_prompt_embeds[0].ndim == 2:
889+
negative_pooled_prompt_embeds = negative_prompt_embeds[0]
887890
negative_prompt_embeds = negative_prompt_embeds.hidden_states[-2]
888891

889892
negative_prompt_embeds_list.append(negative_prompt_embeds)

examples/community/pipeline_demofusion_sdxl.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,9 @@ def encode_prompt(
294294
)
295295

296296
# We are only ALWAYS interested in the pooled output of the final text encoder
297-
pooled_prompt_embeds = prompt_embeds[0]
297+
if pooled_prompt_embeds is None and prompt_embeds[0].ndim == 2:
298+
pooled_prompt_embeds = prompt_embeds[0]
299+
298300
prompt_embeds = prompt_embeds.hidden_states[-2]
299301

300302
prompt_embeds_list.append(prompt_embeds)
@@ -346,7 +348,8 @@ def encode_prompt(
346348
output_hidden_states=True,
347349
)
348350
# We are only ALWAYS interested in the pooled output of the final text encoder
349-
negative_pooled_prompt_embeds = negative_prompt_embeds[0]
351+
if negative_pooled_prompt_embeds is None and negative_prompt_embeds[0].ndim == 2:
352+
negative_pooled_prompt_embeds = negative_prompt_embeds[0]
350353
negative_prompt_embeds = negative_prompt_embeds.hidden_states[-2]
351354

352355
negative_prompt_embeds_list.append(negative_prompt_embeds)

examples/community/pipeline_flux_differential_img2img.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -875,10 +875,10 @@ def __call__(
875875
image_seq_len = (int(height) // self.vae_scale_factor) * (int(width) // self.vae_scale_factor)
876876
mu = calculate_shift(
877877
image_seq_len,
878-
self.scheduler.config.base_image_seq_len,
879-
self.scheduler.config.max_image_seq_len,
880-
self.scheduler.config.base_shift,
881-
self.scheduler.config.max_shift,
878+
self.scheduler.config.get("base_image_seq_len", 256),
879+
self.scheduler.config.get("max_image_seq_len", 4096),
880+
self.scheduler.config.get("base_shift", 0.5),
881+
self.scheduler.config.get("max_shift", 1.16),
882882
)
883883
timesteps, num_inference_steps = retrieve_timesteps(
884884
self.scheduler,

examples/community/pipeline_flux_rf_inversion.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -820,10 +820,10 @@ def __call__(
820820
image_seq_len = (int(height) // self.vae_scale_factor // 2) * (int(width) // self.vae_scale_factor // 2)
821821
mu = calculate_shift(
822822
image_seq_len,
823-
self.scheduler.config.base_image_seq_len,
824-
self.scheduler.config.max_image_seq_len,
825-
self.scheduler.config.base_shift,
826-
self.scheduler.config.max_shift,
823+
self.scheduler.config.get("base_image_seq_len", 256),
824+
self.scheduler.config.get("max_image_seq_len", 4096),
825+
self.scheduler.config.get("base_shift", 0.5),
826+
self.scheduler.config.get("max_shift", 1.16),
827827
)
828828
timesteps, num_inference_steps = retrieve_timesteps(
829829
self.scheduler,
@@ -990,10 +990,10 @@ def invert(
990990
image_seq_len = (int(height) // self.vae_scale_factor // 2) * (int(width) // self.vae_scale_factor // 2)
991991
mu = calculate_shift(
992992
image_seq_len,
993-
self.scheduler.config.base_image_seq_len,
994-
self.scheduler.config.max_image_seq_len,
995-
self.scheduler.config.base_shift,
996-
self.scheduler.config.max_shift,
993+
self.scheduler.config.get("base_image_seq_len", 256),
994+
self.scheduler.config.get("max_image_seq_len", 4096),
995+
self.scheduler.config.get("base_shift", 0.5),
996+
self.scheduler.config.get("max_shift", 1.16),
997997
)
998998
timesteps, num_inversion_steps = retrieve_timesteps(
999999
self.scheduler,

0 commit comments

Comments
 (0)