Download shared/mps/__init__.py from 1ripon1/ColabWan: direct link, hf CLI and curl.
- Browser
- Download file 344 Bytes
-
https://huggingface.co/spaces/1ripon1/ColabWan/resolve/main/shared/mps/__init__.py
- Command line
-
hf download hf://spaces/1ripon1/ColabWan/shared/mps/__init__.py
-
curl -L -o __init__.py https://huggingface.co/spaces/1ripon1/ColabWan/resolve/main/shared/mps/__init__.py
344 Bytes
| """MPS compatibility helpers and local test scripts.""" | |
| def is_mps_available(): | |
| import torch | |
| return hasattr(torch.backends, "mps") and torch.backends.mps.is_available() | |
| def mps_device(): | |
| import torch | |
| return torch.device("mps") if is_mps_available() else None | |
| def mps_device_or(default): | |
| return mps_device() or default | |