diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2024-01-01 11:45:12 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-01 11:45:12 +0000 |
commit | 267fd5d76b00b0c22edffa83c1a078680ba8b42f (patch) | |
tree | c4092b8ec7430f15aaac7d9f8a0fa2199de28140 /modules/sd_models.py | |
parent | d613cd17c72c753bd1e314dff74dc22d9a949374 (diff) | |
parent | 5381405eaa1e809e5cfb97522bd4c19d3c946079 (diff) | |
download | stable-diffusion-webui-gfx803-267fd5d76b00b0c22edffa83c1a078680ba8b42f.tar.gz stable-diffusion-webui-gfx803-267fd5d76b00b0c22edffa83c1a078680ba8b42f.tar.bz2 stable-diffusion-webui-gfx803-267fd5d76b00b0c22edffa83c1a078680ba8b42f.zip |
Merge pull request #14145 from drhead/zero-terminal-snr
Implement zero terminal SNR noise schedule option
Diffstat (limited to 'modules/sd_models.py')
-rw-r--r-- | modules/sd_models.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/sd_models.py b/modules/sd_models.py index d0046f88..50bc209e 100644 --- a/modules/sd_models.py +++ b/modules/sd_models.py @@ -401,6 +401,7 @@ def load_model_weights(model, checkpoint_info: CheckpointInfo, state_dict, timer if shared.cmd_opts.no_half:
model.float()
+ model.alphas_cumprod_original = model.alphas_cumprod
devices.dtype_unet = torch.float32
timer.record("apply float()")
else:
@@ -414,7 +415,11 @@ def load_model_weights(model, checkpoint_info: CheckpointInfo, state_dict, timer if shared.cmd_opts.upcast_sampling and depth_model:
model.depth_model = None
+ alphas_cumprod = model.alphas_cumprod
+ model.alphas_cumprod = None
model.half()
+ model.alphas_cumprod = alphas_cumprod
+ model.alphas_cumprod_original = alphas_cumprod
model.first_stage_model = vae
if depth_model:
model.depth_model = depth_model
@@ -691,6 +696,7 @@ def load_model(checkpoint_info=None, already_loaded_state_dict=None): else:
weight_dtype_conversion = {
'first_stage_model': None,
+ 'alphas_cumprod': None,
'': torch.float16,
}
|