Skip to content

Some checkpoints have no state_dict and cannot be converted to diffusers. #1876

@camenduru

Description

@camenduru

Describe the bug

I downloaded two popular model from civitai and both of them has no state_dict

I put them here:

https://huggingface.co/ckpt/Protogen_V2.2/blob/main/Protogen_V2.2.ckpt
https://huggingface.co/ckpt/elldrethSLucidMix_v10/blob/main/elldrethSLucidMix_v10.ckpt

inside elldrethSLucidMix_v10.ckpt

betas
alphas_cumprod
alphas_cumprod_prev
sqrt_alphas_cumprod
sqrt_one_minus_alphas_cumprod
log_one_minus_alphas_cumprod
sqrt_recip_alphas_cumprod
sqrt_recipm1_alphas_cumprod
posterior_variance
posterior_log_variance_clipped
posterior_mean_coef1
posterior_mean_coef2
model.diffusion_model.time_embed.0.weight
model.diffusion_model.time_embed.0.bias
model.diffusion_model.time_embed.2.weight
model.diffusion_model.time_embed.2.bias
model.diffusion_model.input_blocks.0.0.weight

inside Protogen_V2.2.ckpt

model.diffusion_model.input_blocks.0.0.weight
model.diffusion_model.input_blocks.0.0.bias
model.diffusion_model.time_embed.0.weight
model.diffusion_model.time_embed.0.bias
model.diffusion_model.time_embed.2.weight
model.diffusion_model.time_embed.2.bias
model.diffusion_model.input_blocks.1.1.norm.weight
model.diffusion_model.input_blocks.1.1.norm.bias
model.diffusion_model.input_blocks.1.1.proj_in.weight
model.diffusion_model.input_blocks.1.1.proj_in.bias

normal model first key
state_dict

Reproduction

checkpoint = checkpoint["state_dict"]

!python convert_original_stable_diffusion_to_diffusers.py --checkpoint_path /content/ckpt/elldrethSLucidMix_v10.ckpt --dump_path pt

Logs

global_step key not found in model
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /home/user/app/convert_original_stable_diffusion_to_diffusers.py:869 in      │
│                                                                      │
│                                                                              │
│    866 │   else:                                                             │
│    867 │   │   print("global_step key not found in model")                   │
│    868 │   │   global_step = None                                            │
│ ❱  869 │   checkpoint = checkpoint["state_dict"]                             │
│    870 │                                                                     │
│    871 │   upcast_attention = False                                          │
│    872 │   if args.original_config_file is None:                             │
╰──────────────────────────────────────────────────────────────────────────────╯
KeyError: 'state_dict'

System Info

🥔

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions