Skip to content

Commit 2cc83b8

Browse files
authored
Merge branch 'main' into parallel-shards-loading
2 parents 35e859b + 7b10e4a commit 2cc83b8

File tree

18 files changed

+411
-115
lines changed

18 files changed

+411
-115
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
"librosa",
117117
"numpy",
118118
"parameterized",
119-
"peft>=0.15.0",
119+
"peft>=0.17.0",
120120
"protobuf>=3.20.3,<4",
121121
"pytest",
122122
"pytest-timeout",

src/diffusers/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@
139139
"AutoGuidance",
140140
"ClassifierFreeGuidance",
141141
"ClassifierFreeZeroStarGuidance",
142+
"FrequencyDecoupledGuidance",
142143
"PerturbedAttentionGuidance",
143144
"SkipLayerGuidance",
144145
"SmoothedEnergyGuidance",
@@ -804,6 +805,7 @@
804805
AutoGuidance,
805806
ClassifierFreeGuidance,
806807
ClassifierFreeZeroStarGuidance,
808+
FrequencyDecoupledGuidance,
807809
PerturbedAttentionGuidance,
808810
SkipLayerGuidance,
809811
SmoothedEnergyGuidance,

src/diffusers/dependency_versions_table.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"librosa": "librosa",
2424
"numpy": "numpy",
2525
"parameterized": "parameterized",
26-
"peft": "peft>=0.15.0",
26+
"peft": "peft>=0.17.0",
2727
"protobuf": "protobuf>=3.20.3,<4",
2828
"pytest": "pytest",
2929
"pytest-timeout": "pytest-timeout",

src/diffusers/guiders/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from .auto_guidance import AutoGuidance
2323
from .classifier_free_guidance import ClassifierFreeGuidance
2424
from .classifier_free_zero_star_guidance import ClassifierFreeZeroStarGuidance
25+
from .frequency_decoupled_guidance import FrequencyDecoupledGuidance
2526
from .perturbed_attention_guidance import PerturbedAttentionGuidance
2627
from .skip_layer_guidance import SkipLayerGuidance
2728
from .smoothed_energy_guidance import SmoothedEnergyGuidance
@@ -32,6 +33,7 @@
3233
AutoGuidance,
3334
ClassifierFreeGuidance,
3435
ClassifierFreeZeroStarGuidance,
36+
FrequencyDecoupledGuidance,
3537
PerturbedAttentionGuidance,
3638
SkipLayerGuidance,
3739
SmoothedEnergyGuidance,

src/diffusers/guiders/frequency_decoupled_guidance.py

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

src/diffusers/loaders/lora_conversion_utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,11 @@ def _convert(original_key, diffusers_key, state_dict, new_state_dict):
817817
# has both `peft` and non-peft state dict.
818818
has_peft_state_dict = any(k.startswith("transformer.") for k in state_dict)
819819
if has_peft_state_dict:
820-
state_dict = {k: v for k, v in state_dict.items() if k.startswith("transformer.")}
820+
state_dict = {
821+
k.replace("lora_down.weight", "lora_A.weight").replace("lora_up.weight", "lora_B.weight"): v
822+
for k, v in state_dict.items()
823+
if k.startswith("transformer.")
824+
}
821825
return state_dict
822826

823827
# Another weird one.

src/diffusers/loaders/peft.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,9 @@ def map_state_dict_for_hotswap(sd):
320320
# it to None
321321
incompatible_keys = None
322322
else:
323-
inject_adapter_in_model(lora_config, self, adapter_name=adapter_name, **peft_kwargs)
323+
inject_adapter_in_model(
324+
lora_config, self, adapter_name=adapter_name, state_dict=state_dict, **peft_kwargs
325+
)
324326
incompatible_keys = set_peft_model_state_dict(self, state_dict, adapter_name, **peft_kwargs)
325327

326328
if self._prepare_lora_hotswap_kwargs is not None:

src/diffusers/models/transformers/transformer_flux.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ def forward(
384384
temb: torch.Tensor,
385385
image_rotary_emb: Optional[Tuple[torch.Tensor, torch.Tensor]] = None,
386386
joint_attention_kwargs: Optional[Dict[str, Any]] = None,
387-
) -> torch.Tensor:
387+
) -> Tuple[torch.Tensor, torch.Tensor]:
388388
text_seq_len = encoder_hidden_states.shape[1]
389389
hidden_states = torch.cat([encoder_hidden_states, hidden_states], dim=1)
390390

src/diffusers/pipelines/qwenimage/pipeline_qwenimage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def _get_qwen_prompt_embeds(
201201
txt = [template.format(e) for e in prompt]
202202
txt_tokens = self.tokenizer(
203203
txt, max_length=self.tokenizer_max_length + drop_idx, padding=True, truncation=True, return_tensors="pt"
204-
).to(self.device)
204+
).to(device)
205205
encoder_hidden_states = self.text_encoder(
206206
input_ids=txt_tokens.input_ids,
207207
attention_mask=txt_tokens.attention_mask,

src/diffusers/utils/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
is_k_diffusion_available,
8383
is_k_diffusion_version,
8484
is_kernels_available,
85+
is_kornia_available,
8586
is_librosa_available,
8687
is_matplotlib_available,
8788
is_nltk_available,

0 commit comments

Comments
 (0)