From a960d2482593d0a3351aee7f76de9b9335813b69 Mon Sep 17 00:00:00 2001 From: lllyasviel Date: Tue, 10 Oct 2023 13:44:01 -0700 Subject: [PATCH] better memory management (#629) * better memory management * better memory management --- fooocus_version.py | 2 +- modules/patch.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/fooocus_version.py b/fooocus_version.py index 1a0ee32..66b7bbe 100644 --- a/fooocus_version.py +++ b/fooocus_version.py @@ -1 +1 @@ -version = '2.1.38' +version = '2.1.39' diff --git a/modules/patch.py b/modules/patch.py index f41d67d..e565e51 100644 --- a/modules/patch.py +++ b/modules/patch.py @@ -471,9 +471,12 @@ def patched_get_autocast_device(dev): def patch_all(): if not comfy.model_management.DISABLE_SMART_MEMORY: - if comfy.model_management.total_vram < 20 * 1024: + vram_inadequate = comfy.model_management.total_vram < 20 * 1024 + is_old_gpu_arch = not comfy.model_management.should_use_fp16() + if vram_inadequate or is_old_gpu_arch: # https://github.com/lllyasviel/Fooocus/issues/602 - print('[Fooocus Smart Memory] VRAM is less than 20GB: always disable smart memory.') + print(f'[Fooocus Smart Memory] Disabling smart memory, ' + f'vram_inadequate = {vram_inadequate}, is_old_gpu_arch = {is_old_gpu_arch}.') comfy.model_management.DISABLE_SMART_MEMORY = True args_manager.args.disable_smart_memory = True comfy.cli_args.args.disable_smart_memory = True