add two asserts to diffusion prior to ensure matching image embedding dimensions for clip, diffusion prior network, and what was set on diffusion prior

This commit is contained in:
Phil Wang
2022-08-28 10:11:37 -07:00
parent 1cc5d0afa7
commit ba58ae0bf2
2 changed files with 5 additions and 1 deletions

View File

@@ -1166,6 +1166,10 @@ class DiffusionPrior(nn.Module):
self.net = net self.net = net
self.image_embed_dim = default(image_embed_dim, lambda: clip.dim_latent) self.image_embed_dim = default(image_embed_dim, lambda: clip.dim_latent)
assert net.dim == self.image_embed_dim, f'your diffusion prior network has a dimension of {net.dim}, but you set your image embedding dimension (keyword image_embed_dim) on DiffusionPrior to {self.image_embed_dim}'
assert not exists(clip) or clip.dim_latent == self.image_embed_dim, f'you passed in a CLIP to the diffusion prior with latent dimensions of {clip.dim_latent}, but your image embedding dimension (keyword image_embed_dim) for the DiffusionPrior was set to {self.image_embed_dim}'
self.channels = default(image_channels, lambda: clip.image_channels) self.channels = default(image_channels, lambda: clip.image_channels)
self.text_cond_drop_prob = default(text_cond_drop_prob, cond_drop_prob) self.text_cond_drop_prob = default(text_cond_drop_prob, cond_drop_prob)

View File

@@ -1 +1 @@
__version__ = '1.10.0' __version__ = '1.10.1'