The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
Try to fix slow load issue on low ram hardware with pinned mem. (#10536)
comfyanonymous25de7b1bfa22
diff --git a/comfy/model_patcher.py b/comfy/model_patcher.pyindex 119119e96..74b9e48bc 100644--- a/comfy/model_patcher.py+++ b/comfy/model_patcher.py@@ -658,6 +658,7 @@ class ModelPatcher:loading = self._load_list()load_completely = []+ offloaded = []loading.sort(reverse=True)for x in loading:n = x[1]@@ -699,8 +700,7 @@ class ModelPatcher:patch_counter += 1cast_weight = True- for param in params:- self.pin_weight_to_device("{}.{}".format(n, param))+ offloaded.append((module_mem, n, m, params))else:if hasattr(m, "comfy_cast_weights"):wipe_lowvram_weight(m)@@ -741,6 +741,12 @@ class ModelPatcher:for x in load_completely:x[2].to(device_to)+ for x in offloaded:+ n = x[1]+ params = x[3]+ for param in params:+ self.pin_weight_to_device("{}.{}".format(n, param))+if lowvram_counter > 0:logging.info("loaded partially {} {} {}".format(lowvram_model_memory / (1024 * 1024), mem_counter / (1024 * 1024), patch_counter))self.model.model_lowvram = True