CrazyBoyM/dreambooth-for-diffusion

用ckpt2diffusers.py转ckpt时出错

Opened this issue · 1 comments

RuntimeError: Error(s) in loading state_dict for AutoencoderKL:
Missing key(s) in state_dict:
"encoder.mid_block.attentions.0.to_q.weight",
"encoder.mid_block.attentions.0.to_q.bias",
"encoder.mid_block.attentions.0.to_k.weight",
"encoder.mid_block.attentions.0.to_k.bias",
"encoder.mid_block.attentions.0.to_v.weight",
"encoder.mid_block.attentions.0.to_v.bias",
"encoder.mid_block.attentions.0.to_out.0.weight",
"encoder.mid_block.attentions.0.to_out.0.bias",
"decoder.mid_block.attentions.0.to_q.weight",
"decoder.mid_block.attentions.0.to_q.bias",
"decoder.mid_block.attentions.0.to_k.weight",
"decoder.mid_block.attentions.0.to_k.bias",
"decoder.mid_block.attentions.0.to_v.weight",
"decoder.mid_block.attentions.0.to_v.bias",
"decoder.mid_block.attentions.0.to_out.0.weight",
"decoder.mid_block.attentions.0.to_out.0.bias".
Unexpected key(s) in state_dict:
"encoder.mid_block.attentions.0.query.weight",
"encoder.mid_block.attentions.0.query.bias",
"encoder.mid_block.attentions.0.key.weight",
"encoder.mid_block.attentions.0.key.bias",
"encoder.mid_block.attentions.0.value.weight",
"encoder.mid_block.attentions.0.value.bias",
"encoder.mid_block.attentions.0.proj_attn.weight",
"encoder.mid_block.attentions.0.proj_attn.bias",
"decoder.mid_block.attentions.0.query.weight",
"decoder.mid_block.attentions.0.query.bias",
"decoder.mid_block.attentions.0.key.weight",
"decoder.mid_block.attentions.0.key.bias",
"decoder.mid_block.attentions.0.value.weight",
"decoder.mid_block.attentions.0.value.bias",
"decoder.mid_block.attentions.0.proj_attn.weight",
"decoder.mid_block.attentions.0.proj_attn.bias".

OranHe commented

我也遇到了一样的问题,通过修改vae.load_state_dict(converted_vae_checkpoint)为vae.load_state_dict(converted_vae_checkpoint, strict=False)解决