generative-models icon indicating copy to clipboard operation
generative-models copied to clipboard

where CheckpointEngine?

Open neggles opened this issue 1 year ago • 5 comments

alleged to exist:

https://github.com/Stability-AI/generative-models/blob/9d759324e914de6c96dbd1468b3a4a50243c6528/sgm/models/autoencoder.py#L49-L58

but he is not present: image

when will my CheckpointEngine return from war?

neggles avatar Dec 01 '23 11:12 neggles

Same question! Have you handle this? Thank you !

liwrui avatar Dec 18 '23 03:12 liwrui

Any update?

densechen avatar Jan 05 '24 02:01 densechen

I'm having the same issue,Have you handle it?

jueer33 avatar Mar 13 '24 07:03 jueer33

Does anyone have an alternative?

Medha-Sen avatar Apr 14 '24 06:04 Medha-Sen

You could replace the function alltogether

def apply_ckpt(self, ckpt: Union[None, str, dict]):
    if ckpt is None:
        return
    if ckpt.endswith("ckpt"):
        sd = torch.load(ckpt, map_location="cpu")["state_dict"]
    elif ckpt.endswith("safetensors"):
        sd = load_safetensors(ckpt)
    else:
        raise NotImplementedError

    missing, unexpected = self.load_state_dict(sd, strict=False)
    print(
        f"Restored from {ckpt} with {len(missing)} missing and {len(unexpected)} unexpected keys"
    )

    if len(missing) > 0:
        print(f"Missing Keys: {missing}")
    if len(unexpected) > 0:
        print(f"Unexpected Keys: {unexpected}")

devansh20la avatar Apr 19 '24 01:04 devansh20la