Spaces:
Build error
Build error
File size: 304 Bytes
6285ada |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
import torch
def get_device():
if torch.cuda.is_available():
return "cuda"
elif torch.backends.mps.is_available():
return "mps"
else:
return "cpu"
def set_seed(seed):
torch.manual_seed(seed)
if torch.cuda.is_available():
torch.cuda.manual_seed(seed) |