imaginAIry/imaginairy/vendored/imaginairy_normal_map/utils.py
Bryce d5a276584b fix: move normal map code inline
Fixes conda package. Fixes #317
2023-05-06 13:01:50 -07:00

16 lines
277 B
Python

from functools import lru_cache
import torch
@lru_cache()
def get_device() -> str:
"""Return the best torch backend available."""
if torch.cuda.is_available():
return "cuda"
if torch.backends.mps.is_available():
return "mps:0"
return "cpu"