better memory management (#629)

* better memory management

* better memory management
This commit is contained in:
lllyasviel 2023-10-10 13:44:01 -07:00 committed by GitHub
parent 1601af43be
commit a960d24825
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -1 +1 @@
version = '2.1.38'
version = '2.1.39'

View File

@ -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