File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -2024,12 +2024,15 @@ def lora_state_dict(
20242024 f"The alpha key ({ k } ) seems to be incorrect. If you think this error is unexpected, please open as issue."
20252025 )
20262026
2027- outputs = [state_dict ]
2028- if return_alphas :
2029- outputs .append (network_alphas )
2030- if return_lora_metadata :
2031- outputs .append (metadata )
2032- return tuple (outputs )
2027+ if return_alphas or return_lora_metadata :
2028+ outputs = [state_dict ]
2029+ if return_alphas :
2030+ outputs .append (network_alphas )
2031+ if return_lora_metadata :
2032+ outputs .append (metadata )
2033+ return tuple (outputs )
2034+ else :
2035+ return state_dict
20332036
20342037 def load_lora_weights (
20352038 self ,
@@ -2082,7 +2085,6 @@ def load_lora_weights(
20822085 state_dict , network_alphas , metadata = self .lora_state_dict (
20832086 pretrained_model_name_or_path_or_dict , return_alphas = True , ** kwargs
20842087 )
2085- print (f"{ metadata = } " )
20862088
20872089 has_lora_keys = any ("lora" in key for key in state_dict .keys ())
20882090
You can’t perform that action at this time.
0 commit comments