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