diff --git a/comfy/cli_args.py b/comfy/cli_args.py index cc1f12482..1eddeebd4 100644 --- a/comfy/cli_args.py +++ b/comfy/cli_args.py @@ -132,6 +132,8 @@ parser.add_argument("--reserve-vram", type=float, default=None, help="Set the am parser.add_argument("--async-offload", action="store_true", help="Use async weight offloading.") +parser.add_argument("--flipflop-offload", action="store_true", help="Use async flipflop weight offloading for supported DiT models.") + parser.add_argument("--force-non-blocking", action="store_true", help="Force ComfyUI to use non-blocking operations for all applicable tensors. This may improve performance on some non-Nvidia systems but can cause issues with some workflows.") parser.add_argument("--default-hashing-function", type=str, choices=['md5', 'sha1', 'sha256', 'sha512'], default='sha256', help="Allows you to choose the hash function to use for duplicate filename / contents comparison. Default is sha256.") diff --git a/comfy/model_management.py b/comfy/model_management.py index 709ebc40b..c0edb251d 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -1001,6 +1001,8 @@ def force_channels_last(): #TODO return False +def flipflop_enabled(): + return args.flipflop_offload STREAMS = {} NUM_STREAMS = 1 diff --git a/comfy/model_patcher.py b/comfy/model_patcher.py index d810e5b76..18e6f2e23 100644 --- a/comfy/model_patcher.py +++ b/comfy/model_patcher.py @@ -624,6 +624,8 @@ class ModelPatcher: def supports_flipflop(self): # flipflop requires diffusion_model, explicit flipflop support, NVIDIA CUDA streams, and loading/offloading VRAM + if not comfy.model_management.flipflop_enabled(): + return False if not hasattr(self.model, "diffusion_model"): return False if not getattr(self.model.diffusion_model, "enable_flipflop", False):