Update clip_guided_stable_diffusion.py

This commit is contained in:
Suraj Patil 2022-10-06 18:38:09 +02:00 committed by GitHub
parent 970e30606c
commit 435433cefd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -146,7 +146,7 @@ class CLIPGuidedStableDiffusion(DiffusionPipeline):
image = self.make_cutouts(image, num_cutouts)
else:
image = transforms.Resize(self.feature_extractor.size)(image)
image = self.normalize(image)
image = self.normalize(image).to(latents.dtype)
image_embeddings_clip = self.clip_model.get_image_features(image)
image_embeddings_clip = image_embeddings_clip / image_embeddings_clip.norm(p=2, dim=-1, keepdim=True)