better memory management (#628)

This commit is contained in:
lllyasviel 2023-10-10 13:27:31 -07:00 committed by GitHub
parent e44e1e5b67
commit 1601af43be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

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

View File

@ -15,6 +15,8 @@ import comfy.sd
import comfy.cldm.cldm
import comfy.model_patcher
import comfy.samplers
import comfy.cli_args
import args_manager
import modules.advanced_parameters as advanced_parameters
from comfy.k_diffusion import utils
@ -468,6 +470,14 @@ 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:
# https://github.com/lllyasviel/Fooocus/issues/602
print('[Fooocus Smart Memory] VRAM is less than 20GB: always disable smart memory.')
comfy.model_management.DISABLE_SMART_MEMORY = True
args_manager.args.disable_smart_memory = True
comfy.cli_args.args.disable_smart_memory = True
comfy.model_management.get_autocast_device = patched_get_autocast_device
comfy.samplers.SAMPLER_NAMES += ['dpmpp_fooocus_2m_sde_inpaint_seamless']
comfy.model_management.text_encoder_device = text_encoder_device_patched