safe load non-sparse controlnet

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2025-11-11 16:15:47 -05:00
parent 385de2f0af
commit 26d89c0133
2 changed files with 7 additions and 1 deletions
+1
View File
@@ -36,6 +36,7 @@ TBD
- detailer: using lora in detailer prompt
- detailer: fail on unsupported models instead of corrputing results
- ui: fix collapsible panels
- control: safe load non-sparse controlnet
## Update for 2025-11-06
+6 -1
View File
@@ -353,7 +353,12 @@ class ControlNet():
if self.dtype is not None:
self.model.to(self.dtype)
if self.device is not None:
self.model.to_empty(device=self.device) # model could be sparse
if (opts.diffusers_offload_mode != 'balanced') and hasattr(self.model, 'to'):
try:
self.model.to(self.device)
except Exception as e:
if 'Cannot copy out of meta tensor' in str(e):
self.model.to_empty(device=self.device)
if "Control" in opts.sdnq_quantize_weights:
try:
log.debug(f'Control {what} model SDNQ quantize: id="{model_id}"')