MCPcopy Create free account
hub / github.com/Monalissaa/DisenDiff / load_model_from_config

Function load_model_from_config

src/composenW.py:23–31  ·  view source on GitHub ↗
(config, ckpt)

Source from the content-addressed store, hash-verified

21
22
23def load_model_from_config(config, ckpt):
24 print(f"Loading model from {ckpt}")
25 pl_sd = torch.load(ckpt, map_location="cpu")
26 sd = pl_sd["state_dict"]
27 model = instantiate_from_config(config.model)
28 m, u = model.load_state_dict(sd, strict=False)
29 model.cuda()
30 model.eval()
31 return model
32
33
34def get_model(path):

Callers 1

get_modelFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected