Files
UltraSinger/moduls/DeviceDetection/device_detection.py
T
2023-05-28 14:46:39 +02:00

20 lines
612 B
Python

import tensorflow as tf
from moduls.Log import PRINT_ULTRASTAR, print_red_highlighted_text
def get_available_device():
gpus = tf.config.list_physical_devices('GPU')
if not gpus:
print(f"{PRINT_ULTRASTAR} There are no GPUs available. Using {print_red_highlighted_text('cpu')}.")
return "cpu"
print(f"{PRINT_ULTRASTAR} Found available GPUs:")
for gpu in gpus:
print("Name:", gpu.name, " Type:", gpu.device_type)
# Todo: Finish this
print(f"{PRINT_ULTRASTAR} GPU usage are currently in development. Using {print_red_highlighted_text('cpu')}")
return "cpu"