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.

Make ModelPatcher class clone function work with inheritance.

comfyanonymous452179fe4fd5
diff --git a/comfy/model_patcher.py b/comfy/model_patcher.py
index 4ae3ad25d..fb651242b 100644
--- a/comfy/model_patcher.py
+++ b/comfy/model_patcher.py
@@ -243,7 +243,7 @@ class ModelPatcher:
return self.model.lowvram_patch_counter
def clone(self):
- n = ModelPatcher(self.model, self.load_device, self.offload_device, self.size, weight_inplace_update=self.weight_inplace_update)
+ n = self.__class__(self.model, self.load_device, self.offload_device, self.size, weight_inplace_update=self.weight_inplace_update)
n.patches = {}
for k in self.patches:
n.patches[k] = self.patches[k][:]