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

This commit is contained in:
comfyanonymous
2026-09-20 03:35:58 -04:00
committed by GitHub
parent 96be9a139d
commit 5ba116a40f
3 changed files with 10 additions and 5 deletions
+2 -1
View File
@@ -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.")
+1 -1
View File
@@ -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
+7 -3
View File
@@ -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