MCPcopy Create free account
hub / github.com/LuChengTHU/dpm-solver / logs2pil

Function logs2pil

examples/stable-diffusion/scripts/sample_diffusion.py:36–50  ·  view source on GitHub ↗
(logs, keys=["sample"])

Source from the content-addressed store, hash-verified

34
35
36def logs2pil(logs, keys=["sample"]):
37 imgs = dict()
38 for k in logs:
39 try:
40 if len(logs[k].shape) == 4:
41 img = custom_to_pil(logs[k][0, ...])
42 elif len(logs[k].shape) == 3:
43 img = custom_to_pil(logs[k])
44 else:
45 print(f"Unknown format for key {k}. ")
46 img = None
47 except:
48 img = None
49 imgs[k] = img
50 return imgs
51
52
53@torch.no_grad()

Callers

nothing calls this directly

Calls 1

custom_to_pilFunction · 0.85

Tested by

no test coverage detected