Function
fake_diffusers_current_device
(model: torch.nn.Module, target_device: torch.device)
Source from the content-addressed store, hash-verified
| 59 | |
| 60 | |
| 61 | def 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 | |
| 72 | def get_cuda_free_memory_gb(device=None): |
Callers
nothing calls this directly
Tested by
no test coverage detected