refactor: use model.clone() instead of copy.deepcopy() for model duplication, see #733

This commit is contained in:
Will Miao
2025-12-25 21:15:28 +08:00
parent 91cd88f1df
commit 41759f5e67

View File

@@ -103,7 +103,7 @@ def nunchaku_load_lora(model, lora_name, lora_strength):
# Save the transformer temporarily
model_wrapper.model = None
ret_model = copy.deepcopy(model) # copy everything except the model
ret_model = model.clone()
ret_model_wrapper = ret_model.model.diffusion_model
# Restore the model and set it for the copy