PhotoMaker icon indicating copy to clipboard operation
PhotoMaker copied to clipboard

Sizes of tensors must match except in dimension 1. Expected size 8 but got size 4 for tensor number 1 in the list.

Open canrly opened this issue 1 year ago • 7 comments

[Debug] Generate image using aspect ratio [Instagram (1:1)] => 1024 x 1024 Start inference... [Debug] Prompt: instagram photo, portrait photo of a woman img, colorful, perfect face, natural skin, hard shadows, film grain, [Debug] Neg Prompt: (asymmetry, worst quality, low quality, illustration, 3d, 2d, painting, cartoons, sketch), open mouth 10

Traceback (most recent call last): /photomaker/model.py", line 49, in fuse_fn stacked_id_embeds = torch.cat([prompt_embeds, id_embeds], dim=-1) last line Sizes of tensors must match except in dimension 1. Expected size 8 but got size 4 for tensor number 1 in the list.

canrly avatar Aug 28 '24 08:08 canrly

met the same issue

rudy2steiner avatar Aug 28 '24 16:08 rudy2steiner

+1

channyi avatar Aug 29 '24 07:08 channyi

+1

codewritz-yuri avatar Aug 29 '24 08:08 codewritz-yuri

same issue

hotpot-killer avatar Aug 29 '24 08:08 hotpot-killer

I found out why prompt_embeds's dim zero is always 2 times of id_embeds. This is because the num_tokens = 2. Could anyone give a hint of this parameter's correspondence in the original paper?

I think according its original paper's stacking strategy, shouldn't the prompt_embeds be calculated out of the expansion of the embedding of token of "man" or "woman" ([1x2048]) to [id_num x 2048], and be concated with id_embeds to be [id_num, 4096] then be processed by MLPs? However, in the code's implementation, prompt_embeds are sliced from the original text_embedding with the length of (id_num * num_token).

YIYANGCAI avatar Sep 02 '24 09:09 YIYANGCAI

image image

The image is from update Photomaker v2 V2 seems different from the paper(which may be the so-called 'V1'),that makes the updated code implementation incompatible with V1.

@YIYANGCAI I found out why prompt_embeds's dim zero is always 2 times of id_embeds. This is because the num_tokens = 2.

Sooplex avatar Sep 18 '24 07:09 Sooplex

@rudy2steiner @canrly @Sooplex @hotpot-killer @channyi @codewritz-yuri . Did you guys resolve this issue? This is happening with app.py file. The app_v2.py is good. Please guide if someone resolved!

SajjadIqbal-git avatar Dec 24 '24 05:12 SajjadIqbal-git