aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-08-23 07:10:43 +0300
committerAUTOMATIC1111 <16777216c@gmail.com>2023-08-23 07:10:43 +0300
commit0232a987bb8cbf337a5b34f38f7718aef92af269 (patch)
tree74ad7a35958ce0d818a0e112a1d6f47dac086e90
parent04cfcf91d9a53332b97ba512e86259a59ab4182f (diff)
set devices.dtype_unet correctly
-rw-r--r--modules/sd_models.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/sd_models.py b/modules/sd_models.py
index 4331853a..547e93c4 100644
--- a/modules/sd_models.py
+++ b/modules/sd_models.py
@@ -345,6 +345,7 @@ def load_model_weights(model, checkpoint_info: CheckpointInfo, state_dict, timer
if shared.cmd_opts.no_half:
model.float()
+ devices.dtype_unet = torch.float32
timer.record("apply float()")
else:
vae = model.first_stage_model
@@ -362,9 +363,9 @@ def load_model_weights(model, checkpoint_info: CheckpointInfo, state_dict, timer
if depth_model:
model.depth_model = depth_model
+ devices.dtype_unet = torch.float16
timer.record("apply half()")
- devices.dtype_unet = torch.float16 if model.is_sdxl and not shared.cmd_opts.no_half else model.model.diffusion_model.dtype
devices.unet_needs_upcast = shared.cmd_opts.upcast_sampling and devices.dtype == torch.float16 and devices.dtype_unet == torch.float16
model.first_stage_model.to(devices.dtype_vae)