ControlNet
ControlNet copied to clipboard
Error when transferring control
Traceback:
(control) malo@win11-f8:/mnt/i/source/ControlNet$ python tool_transfer_control.py
logging improved.
Loaded state_dict from [/mnt/i/ckpt/native/sd1-5pruned.ckpt]
Loaded state_dict from [/mnt/i/source/automatic-ui/extensions/sd-webui-controlnet/models/control_sd15_canny.pth]
Loaded state_dict from [/mnt/i/ckpt/native/novelai-pruned.ckpt]
Traceback (most recent call last):
File "tool_transfer_control.py", line 42, in <module>
final_state_dict[key] = input_state_dict[key]
KeyError: 'first_stage_model.encoder.conv_in.weight'
I suggest changing
if is_first_stage or is_cond_stage:
final_state_dict[key] = input_state_dict[key]
continue
to
if is_first_stage or is_cond_stage:
if not input_state_dict.get(key):
continue
final_state_dict[key] = input_state_dict[key]
continue
This will ensure script does not die if one model has a state key that other does not. This helped me to transfer models to novelai.
Sorry for being lazy with PRs