potential fix for #14172
This commit is contained in:
parent
11d23e8ca5
commit
a5f61aa8c5
|
@ -38,6 +38,10 @@ ldm.models.diffusion.ddpm.print = shared.ldm_print
|
|||
optimizers = []
|
||||
current_optimizer: sd_hijack_optimizations.SdOptimization = None
|
||||
|
||||
ldm_original_forward = patches.patch(__file__, ldm.modules.diffusionmodules.openaimodel.UNetModel, "forward", sd_unet.UNetModel_forward)
|
||||
sgm_original_forward = patches.patch(__file__, sgm.modules.diffusionmodules.openaimodel.UNetModel, "forward", sd_unet.UNetModel_forward)
|
||||
|
||||
|
||||
def list_optimizers():
|
||||
new_optimizers = script_callbacks.list_optimizers_callback()
|
||||
|
||||
|
@ -255,9 +259,6 @@ class StableDiffusionModelHijack:
|
|||
|
||||
import modules.models.diffusion.ddpm_edit
|
||||
|
||||
ldm_original_forward = patches.patch(__file__, ldm.modules.diffusionmodules.openaimodel.UNetModel, "forward", sd_unet.UNetModel_forward)
|
||||
sgm_original_forward = patches.patch(__file__, sgm.modules.diffusionmodules.openaimodel.UNetModel, "forward", sd_unet.UNetModel_forward)
|
||||
|
||||
if isinstance(m, ldm.models.diffusion.ddpm.LatentDiffusion):
|
||||
sd_unet.original_forward = ldm_original_forward
|
||||
elif isinstance(m, modules.models.diffusion.ddpm_edit.LatentDiffusion):
|
||||
|
@ -303,11 +304,6 @@ class StableDiffusionModelHijack:
|
|||
self.layers = None
|
||||
self.clip = None
|
||||
|
||||
patches.undo(__file__, ldm.modules.diffusionmodules.openaimodel.UNetModel, "forward")
|
||||
patches.undo(__file__, sgm.modules.diffusionmodules.openaimodel.UNetModel, "forward")
|
||||
|
||||
sd_unet.original_forward = None
|
||||
|
||||
|
||||
def apply_circular(self, enable):
|
||||
if self.circular_enabled == enable:
|
||||
|
|
Loading…
Reference in New Issue