The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
mp: dont deep-clone objects from model_options (#12382)
rattusfe053ba5eb34
diff --git a/comfy/model_patcher.py b/comfy/model_patcher.pyindex b9a117a7c..19c9031ea 100644--- a/comfy/model_patcher.py+++ b/comfy/model_patcher.py@@ -19,7 +19,6 @@from __future__ import annotationsimport collections-import copyimport inspectimport loggingimport math@@ -317,7 +316,7 @@ class ModelPatcher:n.object_patches = self.object_patches.copy()n.weight_wrapper_patches = self.weight_wrapper_patches.copy()- n.model_options = copy.deepcopy(self.model_options)+ n.model_options = comfy.utils.deepcopy_list_dict(self.model_options)n.backup = self.backupn.object_patches_backup = self.object_patches_backupn.parent = selfdiff --git a/comfy/utils.py b/comfy/utils.pyindex 1337e2205..edd80cebe 100644--- a/comfy/utils.py+++ b/comfy/utils.py@@ -1376,3 +1376,21 @@ def string_to_seed(data):else:crc >>= 1return crc ^ 0xFFFFFFFF++def deepcopy_list_dict(obj, memo=None):+ if memo is None:+ memo = {}++ obj_id = id(obj)+ if obj_id in memo:+ return memo[obj_id]++ if isinstance(obj, dict):+ res = {deepcopy_list_dict(k, memo): deepcopy_list_dict(v, memo) for k, v in obj.items()}+ elif isinstance(obj, list):+ res = [deepcopy_list_dict(i, memo) for i in obj]+ else:+ res = obj++ memo[obj_id] = res+ return res