Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

Add --disable-fast-disk to disable fast disk. (#16424)

comfyanonymous5ba116a40f19
diff --git a/comfy/cli_args.py b/comfy/cli_args.py
index 54f2269ff..ba89699d6 100644
--- a/comfy/cli_args.py
+++ b/comfy/cli_args.py
@@ -179,7 +179,8 @@ parser.add_argument("--async-offload", nargs='?', const=2, type=int, default=Non
parser.add_argument("--disable-async-offload", action="store_true", help="Disable async weight offloading.")
parser.add_argument("--disable-dynamic-vram", action="store_true", help="Disable dynamic VRAM and use estimate based model loading.")
parser.add_argument("--enable-dynamic-vram", action="store_true", help="Enable dynamic VRAM on systems where it's not enabled by default.")
-parser.add_argument("--fast-disk", action="store_true", help="Prefer disk-backed dynamic loading and offload over unpinned RAM. Can be faster for users with fast NVME disks.")
+parser.add_argument("--fast-disk", action="store_true", help="Force disk-backed dynamic loading and offload over unpinned RAM. Can be faster for users with fast NVME disks.")
+parser.add_argument("--disable-fast-disk", action="store_true", help="Disable disk-backed dynamic loading and offload over unpinned RAM. Overrides --fast-disk.")
parser.add_argument("--disable-cuda-graphs", action="store_true", help="Disable CUDA graphs.")
parser.add_argument("--disable-comfy-compiler", action="store_true", help="Disable the Comfy model compiler, including its CUDA graph subfeature.")
parser.add_argument("--assert-graph-breaks", action="store_true", help="Fail on Comfy model compiler graph breaks.")
diff --git a/comfy/model_patcher.py b/comfy/model_patcher.py
index 9c7e590a7..bbfc9959b 100644
--- a/comfy/model_patcher.py
+++ b/comfy/model_patcher.py
@@ -341,7 +341,7 @@ class ModelPatcher:
def __init__(self, model, load_device, offload_device, size=0, weight_inplace_update=False, fast_disk=False):
self.size = size
self.model = model
- self.fast_disk = bool(comfy.model_management.args.fast_disk or fast_disk)
+ self.fast_disk = not comfy.model_management.args.disable_fast_disk and bool(comfy.model_management.args.fast_disk or fast_disk)
if not hasattr(self.model, 'device'):
logging.debug("Model doesn't have a device attribute.")
self.model.device = offload_device
diff --git a/comfy/storage.py b/comfy/storage.py
index 0cc555758..2f40250e5 100644
--- a/comfy/storage.py
+++ b/comfy/storage.py
@@ -5,6 +5,7 @@ import platform
import re
import comfy_aimdo.storage
+from comfy.cli_args import args
_NVME_NAMESPACE = re.compile(r"^(nvme\d+)n\d+$")
@@ -97,11 +98,14 @@ def state_dict_fast_disk(state_dict):
path = getattr(untyped_storage(), "_comfy_source_path", None)
if path is not None:
paths.add(path)
- return model_fast_disk(sorted(paths)) if paths else False
+ return model_fast_disk(sorted(paths))
def model_fast_disk(paths):
- results = [fast_storage(path) for path in paths]
- fast = bool(results) and all(result is True for result in results)
+ if args.fast_disk or args.disable_fast_disk:
+ fast = not args.disable_fast_disk
+ else:
+ results = [fast_storage(path) for path in paths]
+ fast = bool(results) and all(result is True for result in results)
logging.info("Model storage policy: fast_disk=%s paths=%s", fast, [os.path.realpath(path) for path in paths])
return fast