mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-04-15 13:02:35 +08:00
Prevent overwriting existing keys in state_dict
Ensure new key is added only if it doesn't exist.
This commit is contained in:
parent
a73ac772b5
commit
479536e34d
@ -37,7 +37,8 @@ def twinflow_z_image_lora_to_diffusers(state_dict):
|
||||
for key in list(state_dict.keys()):
|
||||
if "t_embedder_2" not in key and key.startswith("t_embedder."):
|
||||
new_key = key.replace("t_embedder.", "t_embedder_2.", 1)
|
||||
state_dict[new_key] = state_dict.pop(key)
|
||||
if new_key not in state_dict:
|
||||
state_dict[new_key] = state_dict.pop(key)
|
||||
return state_dict
|
||||
|
||||
def convert_lora(sd):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user