From d4a348a2b2ac64530b4435873a69bebe2ee897e0 Mon Sep 17 00:00:00 2001 From: Marc-Andre Ferland Date: Sun, 16 Oct 2022 23:12:46 -0400 Subject: [PATCH] Process GFPGANer on cuda:0 when possible, otherwise use cpu. --- ui/sd_internal/task_manager.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/sd_internal/task_manager.py b/ui/sd_internal/task_manager.py index 8e61b7ea..4136f7f0 100644 --- a/ui/sd_internal/task_manager.py +++ b/ui/sd_internal/task_manager.py @@ -217,7 +217,8 @@ def thread_render(device): if not queued_task.request.use_cpu and runtime.thread_data.device == 'cpu': continue # CPU Tasks if queued_task.request.use_face_correction and not runtime.is_first_cuda_device(runtime.thread_data.device): - continue #TODO Remove when fixed - A bug with GFPGANer and facexlib needs to be fixed before use on other devices. + if not runtime.thread_data.device == 'cpu' and is_alive(0) > 0: # Allows GFPGANer on cuda:0 and use cpu only when cuda:0 is not available. + continue #TODO Remove when fixed - A bug with GFPGANer and facexlib needs to be fixed before use on other devices. task = queued_task break if task is not None: