(device: str)
| 105 | |
| 106 | |
| 107 | def sync_device(device: str) -> None: |
| 108 | if device == "cuda" and torch.cuda.is_available(): |
| 109 | torch.cuda.synchronize() |
| 110 | elif device == "xpu" and hasattr(torch, "xpu") and torch.xpu.is_available(): |
| 111 | torch.xpu.synchronize() |
| 112 | elif device == "mps" and hasattr(torch, "mps") and hasattr(torch.mps, "synchronize"): |
| 113 | torch.mps.synchronize() |
| 114 | |
| 115 | |
| 116 | def install_controlled_vae_encode_noise(noise_file: str) -> None: |