mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-03-11 20:27:44 +08:00
model_detection: deep clone pre edited edited weights (#12862)
Deep clone these weights as needed to avoid segfaulting when it tries to touch the original mmap.
This commit is contained in:
parent
c4fb0271cd
commit
a912809c25
@ -1,4 +1,5 @@
|
|||||||
import json
|
import json
|
||||||
|
import comfy.memory_management
|
||||||
import comfy.supported_models
|
import comfy.supported_models
|
||||||
import comfy.supported_models_base
|
import comfy.supported_models_base
|
||||||
import comfy.utils
|
import comfy.utils
|
||||||
@ -1118,8 +1119,13 @@ def convert_diffusers_mmdit(state_dict, output_prefix=""):
|
|||||||
new[:old_weight.shape[0]] = old_weight
|
new[:old_weight.shape[0]] = old_weight
|
||||||
old_weight = new
|
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])
|
w = old_weight.narrow(offset[0], offset[1], offset[2])
|
||||||
else:
|
else:
|
||||||
|
if comfy.memory_management.aimdo_enabled:
|
||||||
|
weight = weight.clone()
|
||||||
old_weight = weight
|
old_weight = weight
|
||||||
w = weight
|
w = weight
|
||||||
w[:] = fun(weight)
|
w[:] = fun(weight)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user