mirror of
https://github.com/rakuri255/UltraSinger.git
synced 2026-11-28 01:48:56 +09:00
21 lines
711 B
Python
21 lines
711 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("{} There are no GPUs available. Using {}.".format(PRINT_ULTRASTAR, print_red_highlighted_text("cpu")))
|
|
return "cpu"
|
|
|
|
print("{} Found available GPUs:".format(PRINT_ULTRASTAR))
|
|
for gpu in gpus:
|
|
print("Name:", gpu.name, " Type:", gpu.device_type)
|
|
|
|
# Todo: Finish this
|
|
print("{} GPU usage are currently in development. Using {}".format(PRINT_ULTRASTAR,
|
|
print_red_highlighted_text("cpu")))
|
|
return "cpu"
|