From 0185ef7c83548f6ffc76d6b26333b7310830e7af Mon Sep 17 00:00:00 2001 From: Marc-Andre Ferland Date: Fri, 28 Oct 2022 02:00:59 -0400 Subject: [PATCH 1/3] Apply force_full_precision if was set on device_select. --- ui/sd_internal/runtime.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ui/sd_internal/runtime.py b/ui/sd_internal/runtime.py index 9e98634f..bbb71730 100644 --- a/ui/sd_internal/runtime.py +++ b/ui/sd_internal/runtime.py @@ -77,6 +77,8 @@ def device_select(device): thread_data.device = device thread_data.has_valid_gpu = True + # Apply force_full_precision if was set. + thread_data.precision = 'full' if thread_data.force_full_precision else 'autocast' return True def device_init(device_selection=None): From 02240bda257726b7aadec9e278a2375fa95cf22b Mon Sep 17 00:00:00 2001 From: Marc-Andre Ferland Date: Fri, 28 Oct 2022 02:05:48 -0400 Subject: [PATCH 2/3] Moved up to not duplicate if statement. --- ui/sd_internal/runtime.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/sd_internal/runtime.py b/ui/sd_internal/runtime.py index bbb71730..c85c2108 100644 --- a/ui/sd_internal/runtime.py +++ b/ui/sd_internal/runtime.py @@ -74,11 +74,11 @@ def device_select(device): thread_data.force_full_precision = ('nvidia' in device_name.lower() or 'geforce' in device_name.lower()) and (' 1660' in device_name or ' 1650' in device_name) if thread_data.force_full_precision: print('forcing full precision on NVIDIA 16xx cards, to avoid green images. GPU detected: ', device_name) + # Apply force_full_precision now. + thread_data.precision = 'full' thread_data.device = device thread_data.has_valid_gpu = True - # Apply force_full_precision if was set. - thread_data.precision = 'full' if thread_data.force_full_precision else 'autocast' return True def device_init(device_selection=None): From c52fc843f678ea33ca554d23641636dca8355243 Mon Sep 17 00:00:00 2001 From: Marc-Andre Ferland Date: Fri, 28 Oct 2022 02:09:11 -0400 Subject: [PATCH 3/3] Comment... --- ui/sd_internal/runtime.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/sd_internal/runtime.py b/ui/sd_internal/runtime.py index c85c2108..0aeb1993 100644 --- a/ui/sd_internal/runtime.py +++ b/ui/sd_internal/runtime.py @@ -74,7 +74,7 @@ def device_select(device): thread_data.force_full_precision = ('nvidia' in device_name.lower() or 'geforce' in device_name.lower()) and (' 1660' in device_name or ' 1650' in device_name) if thread_data.force_full_precision: print('forcing full precision on NVIDIA 16xx cards, to avoid green images. GPU detected: ', device_name) - # Apply force_full_precision now. + # Apply force_full_precision now before models are loaded. thread_data.precision = 'full' thread_data.device = device