Protect alphas_cumprod during refiner switchover

This commit is contained in:
drhead 2024-02-20 19:23:21 -05:00 committed by GitHub
parent 0a271938d8
commit 9c1ece8978
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 0 deletions

View File

@ -181,8 +181,12 @@ def apply_refiner(cfg_denoiser):
cfg_denoiser.p.extra_generation_params['Refiner'] = refiner_checkpoint_info.short_title
cfg_denoiser.p.extra_generation_params['Refiner switch at'] = refiner_switch_at
alphas_cumprod_original = cfg_denoiser.p.sd_model.alphas_cumprod_original
alphas_cumprod = cfg_denoiser.p.sd_model.alphas_cumprod
with sd_models.SkipWritingToConfig():
sd_models.reload_model_weights(info=refiner_checkpoint_info)
cfg_denoiser.p.sd_model.alphas_cumprod_original = alphas_cumprod_original
cfg_denoiser.p.sd_model.alphas_cumprod = alphas_cumprod
devices.torch_gc()
cfg_denoiser.p.setup_conds()