UNet from Scratch

Now backend rewrite is about 50% finished.
Estimated finish is in 72 hours.
After that, many newer features will land.
This commit is contained in:
layerdiffusion
2024-08-01 21:19:41 -07:00
parent e3522c8919
commit bc9977a305
20 changed files with 1393 additions and 56 deletions

View File

@@ -46,7 +46,7 @@ class PreprocessorInpaintOnly(PreprocessorInpaint):
# This is a powerful VAE with integrated memory management, bf16, and tiled fallback.
latent_image = vae.encode(self.image.movedim(1, -1))
latent_image = process.sd_model.forge_objects.unet.model.latent_format.process_in(latent_image)
latent_image = process.sd_model.forge_objects.vae.first_stage_model.process_in(latent_image)
B, C, H, W = latent_image.shape
@@ -154,7 +154,7 @@ class PreprocessorInpaintLama(PreprocessorInpaintOnly):
def process_before_every_sampling(self, process, cond, mask, *args, **kwargs):
cond, mask = super().process_before_every_sampling(process, cond, mask, *args, **kwargs)
sigma_max = process.sd_model.forge_objects.unet.model.model_sampling.sigma_max
sigma_max = process.sd_model.forge_objects.unet.model.prediction.sigma_max
original_noise = kwargs['noise']
process.modified_noise = original_noise + self.latent.to(original_noise) / sigma_max.to(original_noise)
return cond, mask