Stability-AI / generative-models

Generative Models by Stability AI
MIT License
23.13k stars 2.55k forks source link

where CheckpointEngine? #216

Open neggles opened 6 months ago

neggles commented 6 months ago

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?

liwrui commented 6 months ago

Same question! Have you handle this? Thank you !

densechen commented 5 months ago

Any update?

jueer33 commented 3 months ago

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

Medha-Sen commented 2 months ago

Does anyone have an alternative?

devansh20la commented 2 months ago

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}")