File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff 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"
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments