Skip to content

Commit b1bd3cb

Browse files
committed
Works in "diffusers mode" on vladmandic
Fixes #437 Didn't test if it solves the issue
1 parent e651485 commit b1bd3cb

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/backbone.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,21 @@ def get_outpath():
6161
def unload_sd_model():
6262
from modules import shared, devices
6363
if shared.sd_model is not None:
64-
shared.sd_model.cond_stage_model.to(devices.cpu)
65-
shared.sd_model.first_stage_model.to(devices.cpu)
64+
if shared.sd_model.cond_stage_model is not None:
65+
shared.sd_model.cond_stage_model.to(devices.cpu)
66+
if shared.sd_model.first_stage_model is not None:
67+
shared.sd_model.first_stage_model.to(devices.cpu)
68+
# Maybe something else???
6669

6770

6871
def reload_sd_model():
6972
from modules import shared, devices
7073
if shared.sd_model is not None:
71-
shared.sd_model.cond_stage_model.to(devices.device)
72-
shared.sd_model.first_stage_model.to(devices.device)
74+
if shared.sd_model.cond_stage_model is not None:
75+
shared.sd_model.cond_stage_model.to(devices.device)
76+
if shared.sd_model.first_stage_model:
77+
shared.sd_model.first_stage_model.to(devices.device)
78+
# Maybe something else???
7379

7480
def get_hide_dirs():
7581
import modules.shared

0 commit comments

Comments
 (0)