MCPcopy Create free account
hub / github.com/NVlabs/LongLive / fake_diffusers_current_device

Function fake_diffusers_current_device

utils/memory.py:61–69  ·  view source on GitHub ↗
(model: torch.nn.Module, target_device: torch.device)

Source from the content-addressed store, hash-verified

59
60
61def fake_diffusers_current_device(model: torch.nn.Module, target_device: torch.device):
62 if hasattr(model, 'scale_shift_table'):
63 model.scale_shift_table.data = model.scale_shift_table.data.to(target_device)
64 return
65
66 for k, p in model.named_modules():
67 if hasattr(p, 'weight'):
68 p.to(target_device)
69 return
70
71
72def get_cuda_free_memory_gb(device=None):

Callers

nothing calls this directly

Calls 1

toMethod · 0.80

Tested by

no test coverage detected