"src/vscode:/vscode.git/clone" did not exist on "7d0b9c4d4ee4ef08908ccc77ee91104d5498feb3"
Unverified Commit beb932c5 authored by Patrick von Platen's avatar Patrick von Platen Committed by GitHub
Browse files

[Conversion SD] Make sure weirdly sorted keys work as well (#1959)

parent 4401e6aa
...@@ -443,8 +443,9 @@ def convert_ldm_unet_checkpoint(checkpoint, config, path=None, extract_ema=False ...@@ -443,8 +443,9 @@ def convert_ldm_unet_checkpoint(checkpoint, config, path=None, extract_ema=False
paths, new_checkpoint, unet_state_dict, additional_replacements=[meta_path], config=config paths, new_checkpoint, unet_state_dict, additional_replacements=[meta_path], config=config
) )
if ["conv.weight", "conv.bias"] in output_block_list.values(): output_block_list = {k: sorted(v) for k, v in output_block_list.items()}
index = list(output_block_list.values()).index(["conv.weight", "conv.bias"]) if ["conv.bias", "conv.weight"] in output_block_list.values():
index = list(output_block_list.values()).index(["conv.bias", "conv.weight"])
new_checkpoint[f"up_blocks.{block_id}.upsamplers.0.conv.weight"] = unet_state_dict[ new_checkpoint[f"up_blocks.{block_id}.upsamplers.0.conv.weight"] = unet_state_dict[
f"output_blocks.{i}.{index}.conv.weight" f"output_blocks.{i}.{index}.conv.weight"
] ]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment