Delcos / Hentai-Diffusion

The official place for the best A.I.
224 stars 20 forks source link

KeyError: 'state_dict' Cannot load model #30

Open linklight2 opened 1 year ago

linklight2 commented 1 year ago

I'm having an issue with the current model, HD-18. The error message I get is this:

KeyError                                  Traceback (most recent call last)
<ipython-input-4-127af4bf47ad> in <module>
    110 opt = config()
    111 config = OmegaConf.load(f"{opt.config}")
--> 112 model = load_model_from_config(config, f"{opt.ckpt}")
    113 model = model.to(device)
    114 batch_idx = 0

<ipython-input-4-127af4bf47ad> in load_model_from_config(config, ckpt, verbose)
     79     if "global_step" in pl_sd:
     80         print(f"Global Step: {pl_sd['global_step']}")
---> 81     sd = pl_sd["state_dict"]
     82     model = instantiate_from_config(config.model)
     83     m, u = model.load_state_dict(sd, strict=False)

KeyError: 'state_dict'

16 and 17 both worked for me, so it's confusing why 18 is showing such an error. I tried redownloading the ckpt and even loaded the model into a Google colab. The model failed to work in all these instances due to this error.