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.

model_detection: deep clone pre edited edited weights (#12862)

rattusa912809c252f
diff --git a/comfy/model_detection.py b/comfy/model_detection.py
index 6eace4628..35a6822e3 100644
--- a/comfy/model_detection.py
+++ b/comfy/model_detection.py
@@ -1,4 +1,5 @@
import json
+import comfy.memory_management
import comfy.supported_models
import comfy.supported_models_base
import comfy.utils
@@ -1118,8 +1119,13 @@ def convert_diffusers_mmdit(state_dict, output_prefix=""):
new[:old_weight.shape[0]] = old_weight
old_weight = new
+ if old_weight is out_sd.get(t[0], None) and comfy.memory_management.aimdo_enabled:
+ old_weight = old_weight.clone()
+
w = old_weight.narrow(offset[0], offset[1], offset[2])
else:
+ if comfy.memory_management.aimdo_enabled:
+ weight = weight.clone()
old_weight = weight
w = weight
w[:] = fun(weight)