fix auto_cast (#622)

This commit is contained in:
lllyasviel 2023-10-10 02:36:19 -07:00 committed by GitHub
parent 778a3cf81e
commit 53573fa073
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

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

View File

@ -455,7 +455,20 @@ def text_encoder_device_patched():
return comfy.model_management.get_torch_device()
def patched_get_autocast_device(dev):
# https://github.com/lllyasviel/Fooocus/discussions/571
# https://github.com/lllyasviel/Fooocus/issues/620
result = ''
if hasattr(dev, 'type'):
result = str(dev.type)
if 'cuda' in result:
return 'cuda'
else:
return 'cpu'
def patch_all():
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
comfy.model_patcher.ModelPatcher.calculate_weight = calculate_weight_patched