MCPcopy
hub / github.com/lllyasviel/FramePack / fake_diffusers_current_device

Function fake_diffusers_current_device

diffusers_helper/memory.py:60–68  ·  view source on GitHub ↗
(model: torch.nn.Module, target_device: torch.device)

Source from the content-addressed store, hash-verified

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

Callers 2

workerFunction · 0.90
workerFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected