Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shape mismatch: value tensor of shape [1024] cannot be broadcast to indexing result of shape [0, 768] #16

Open
shrutidhange opened this issue Nov 28, 2023 · 0 comments

Comments

@shrutidhange
Copy link

Hi Team,
I am able to run the sd v2 related code using command

python main.py --name actor --base ./configs/perfusion_custom_sd_v2.yaml --basedir ./ckpt -t True --gpus 0,

the training runs fine but when I try to create the immages I get the following errors related to shape mismatch: value tensor of shape [1024] cannot be broadcast to indexing result of shape [0, 768]

I am using below command to generate images

python scripts/perfusion_txt2img.py --ddim_eta 0.0 --steps 50 --scale 6.0 --beta 0.7 --tau 0.15 --n_samples 4 --n_iter 1 --personalized_ckpt ./ckpt/2023-11-27T09-04-38_actor/models/last.ckpt --prompt "photo of actor"

Loading model from ./ckpt/v1-5-pruned-emaonly.ckpt and ./ckpt/2023-11-27T09-39-45_teddy/models/last.ckpt
Global Step: 840000
data: 0%| | 0/1 [00:00<?, ?it/s]
Sampling: 0%| | 0/1 [00:00<?, ?it/s]
Traceback (most recent call last):
File "/home/ubuntu/code/Key-Locked-Rank-One-Editing-for-Text-to-Image-Personalization/scripts/perfusion_txt2img.py", line 357, in
main()
File "/home/ubuntu/code/Key-Locked-Rank-One-Editing-for-Text-to-Image-Personalization/scripts/perfusion_txt2img.py", line 317, in main
encoding = model.cond_stage_model.encode(prompts, embedding_manager=model.embedding_manager)
File "/home/ubuntu/code/Key-Locked-Rank-One-Editing-for-Text-to-Image-Personalization/ldm/modules/encoders/modules.py", line 285, in encode
return self(text, **kwargs)
File "/home/ubuntu/miniconda3/envs/aiml2/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/ubuntu/code/Key-Locked-Rank-One-Editing-for-Text-to-Image-Personalization/ldm/modules/encoders/modules.py", line 280, in forward
z = self.transformer(input_ids=tokens, **kwargs)
File "/home/ubuntu/miniconda3/envs/aiml2/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/ubuntu/code/Key-Locked-Rank-One-Editing-for-Text-to-Image-Personalization/ldm/modules/encoders/modules.py", line 259, in transformer_forward
return self.text_model(
File "/home/ubuntu/miniconda3/envs/aiml2/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/ubuntu/code/Key-Locked-Rank-One-Editing-for-Text-to-Image-Personalization/ldm/modules/encoders/modules.py", line 219, in text_encoder_forward
hidden_states = self.embeddings(input_ids=input_ids, position_ids=position_ids,
File "/home/ubuntu/miniconda3/envs/aiml2/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/ubuntu/code/Key-Locked-Rank-One-Editing-for-Text-to-Image-Personalization/ldm/modules/encoders/modules.py", line 143, in embedding_forward
inputs_embeds = embedding_manager(input_ids, inputs_embeds)
File "/home/ubuntu/miniconda3/envs/aiml2/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/ubuntu/code/Key-Locked-Rank-One-Editing-for-Text-to-Image-Personalization/perfusion/embedding_manager.py", line 117, in forward
embedded_text[tokenized_text == placeholder_token] = placeholder_embedding
RuntimeError: shape mismatch: value tensor of shape [1024] cannot be broadcast to indexing result of shape [0, 768]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant