The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
Speed up SDXL on 16xx series with fp16 weights and manual cast.
comfyanonymous24129d78e6ac
diff --git a/comfy/model_management.py b/comfy/model_management.pyindex cbaa80874..aa40c502a 100644--- a/comfy/model_management.py+++ b/comfy/model_management.py@@ -496,7 +496,7 @@ def unet_dtype(device=None, model_params=0):return torch.float8_e4m3fnif args.fp8_e5m2_unet:return torch.float8_e5m2- if should_use_fp16(device=device, model_params=model_params):+ if should_use_fp16(device=device, model_params=model_params, manual_cast=True):return torch.float16return torch.float32@@ -696,7 +696,7 @@ def is_device_mps(device):return Truereturn False-def should_use_fp16(device=None, model_params=0, prioritize_performance=True):+def should_use_fp16(device=None, model_params=0, prioritize_performance=True, manual_cast=False):global directml_enabledif device is not None:@@ -738,7 +738,7 @@ def should_use_fp16(device=None, model_params=0, prioritize_performance=True):if x in props.name.lower():fp16_works = True- if fp16_works:+ if fp16_works or manual_cast:free_model_memory = (get_free_memory() * 0.9 - minimum_inference_memory())if (not prioritize_performance) or model_params * 4 > free_model_memory:return True