Skip to content

Commit

Permalink
[LoRA] default to None when fc alphas are not available. (huggingface…
Browse files Browse the repository at this point in the history
…#4706)

default to None when fc alphas are not available.
  • Loading branch information
sayakpaul authored Aug 22, 2023
1 parent 1e0395e commit 8d30d25
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/diffusers/loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -1400,8 +1400,9 @@ def _modify_text_encoder(

if patch_mlp:
for name, mlp_module in text_encoder_mlp_modules(text_encoder):
fc1_alpha = network_alphas.pop(name + ".fc1.lora_linear_layer.down.weight.alpha")
fc2_alpha = network_alphas.pop(name + ".fc2.lora_linear_layer.down.weight.alpha")
fc1_alpha = network_alphas.pop(name + ".fc1.lora_linear_layer.down.weight.alpha", None)
fc2_alpha = network_alphas.pop(name + ".fc2.lora_linear_layer.down.weight.alpha", None)

current_rank_fc1 = rank.pop(f"{name}.fc1.lora_linear_layer.up.weight")
current_rank_fc2 = rank.pop(f"{name}.fc2.lora_linear_layer.up.weight")

Expand Down

0 comments on commit 8d30d25

Please sign in to comment.