Files
UltraSinger/modules/DeviceDetection/device_detection.py
T
2023-06-08 01:37:10 +02:00

21 lines
485 B
Python

"""Docstring"""
import torch
from modules.console_colors import ULTRASINGER_HEAD, red_highlighted
def get_available_device():
"""Docstring"""
isCuda = torch.cuda.is_available()
if not isCuda:
print(
f"{ULTRASINGER_HEAD} There are no {red_highlighted('cuda')} devices available. -> Using {red_highlighted('cpu')}."
)
return "cpu"
else:
print(f"{ULTRASINGER_HEAD} Using {red_highlighted('cuda')} GPU.")
return "cuda"