Random image
#170
by
cahodk
- opened
How would I create a random image?
I think it should be something like this:
prompt_embeds = pipeline._get_clip_prompt_embeds(
"",
device="cuda",
num_images_per_prompt=1
)
print(f"prompt_embeds shape: {prompt_embeds.shape}")
joint_attention_dim = pipeline.transformer.config.get('joint_attention_dim', 4096)
pooled_prompt_embeds_shape = (768, joint_attention_dim)
print(f"pooled_prompt_embeds shape: {pooled_prompt_embeds_shape}")
pooled_prompt_embeds = torch.rand(pooled_prompt_embeds_shape, dtype=torch.float32).to(dtype=torch.bfloat16, device='cuda')
with torch.no_grad():
generated_image = pipeline(prompt_embeds=prompt_embeds, pooled_prompt_embeds=pooled_prompt_embeds, generator=generator).images[0]
But there is a mismatch in shape
115
116 def forward(self, input: Tensor) -> Tensor:
--> 117 return F.linear(input, self.weight, self.bias)
118
119 def extra_repr(self) -> str:
RuntimeError: mat1 and mat2 shapes cannot be multiplied (768x4096 and 768x3072)