sql-error-classifier / src /device_utils.py
nishu08's picture
Deploy CodeBERT inference Space
8a3099e verified
raw
history blame contribute delete
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"