Spaces:
Runtime error
Runtime error
Download src/device_utils.py from nishu08/sql-error-classifier: direct link, hf CLI and curl.
- Browser
- Download file 257 Bytes
-
https://huggingface.co/spaces/nishu08/sql-error-classifier/resolve/main/src/device_utils.py
- Command line
-
hf download hf://spaces/nishu08/sql-error-classifier/src/device_utils.py
-
curl -L -o device_utils.py https://huggingface.co/spaces/nishu08/sql-error-classifier/resolve/main/src/device_utils.py
257 Bytes
| """Pick the best available torch device.""" | |
| from __future__ import annotations | |
| import torch | |
| def get_device() -> str: | |
| if torch.cuda.is_available(): | |
| return "cuda" | |
| if torch.backends.mps.is_available(): | |
| return "mps" | |
| return "cpu" | |