Skip to content

Commit 5821dd9

Browse files
authored
Merge branch 'main' into qwen-modular
2 parents 7ad48f0 + 6198f8a commit 5821dd9

3 files changed

Lines changed: 7 additions & 1 deletion

File tree

src/diffusers/loaders/lora_conversion_utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2213,6 +2213,10 @@ def convert_key(key: str) -> str:
22132213

22142214
state_dict = {convert_key(k): v for k, v in state_dict.items()}
22152215

2216+
has_default = any("default." in k for k in state_dict)
2217+
if has_default:
2218+
state_dict = {k.replace("default.", ""): v for k, v in state_dict.items()}
2219+
22162220
converted_state_dict = {}
22172221
all_keys = list(state_dict.keys())
22182222
down_key = ".lora_down.weight"

src/diffusers/loaders/lora_pipeline.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4940,7 +4940,8 @@ def lora_state_dict(
49404940
has_alphas_in_sd = any(k.endswith(".alpha") for k in state_dict)
49414941
has_lora_unet = any(k.startswith("lora_unet_") for k in state_dict)
49424942
has_diffusion_model = any(k.startswith("diffusion_model.") for k in state_dict)
4943-
if has_alphas_in_sd or has_lora_unet or has_diffusion_model:
4943+
has_default = any("default." in k for k in state_dict)
4944+
if has_alphas_in_sd or has_lora_unet or has_diffusion_model or has_default:
49444945
state_dict = _convert_non_diffusers_qwen_lora_to_diffusers(state_dict)
49454946

49464947
out = (state_dict, metadata) if return_lora_metadata else state_dict

src/diffusers/utils/dynamic_modules_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ def get_cached_module_file(
358358
proxies=proxies,
359359
local_files_only=local_files_only,
360360
local_dir=local_dir,
361+
revision=revision,
361362
token=token,
362363
)
363364
submodule = os.path.join("local", "--".join(pretrained_model_name_or_path.split("/")))

0 commit comments

Comments
 (0)