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

The size of tensor #36

Open
chilljudaoren opened this issue Dec 3, 2024 · 0 comments
Open

The size of tensor #36

chilljudaoren opened this issue Dec 3, 2024 · 0 comments

Comments

@chilljudaoren
Copy link

File "Eval_ImgCap_BLIP.py", line 120, in evaluate
captions = t_model.generate(adv_images, sample=False, num_beams=config['num_beams'],
File "/home/czh/UAP_VLP-main/models/XVLM/model_captioning.py", line 130, in generate
outputs = self.text_decoder.generate(input_ids=input_ids, #(8,4)
File "/home/czh/.conda/envs/sam/lib/python3.8/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
File "/home/czh/.conda/envs/sam/lib/python3.8/site-packages/transformers/generation/utils.py", line 1627, in generate
return self.beam_search(
File "/home/czh/.conda/envs/sam/lib/python3.8/site-packages/transformers/generation/utils.py", line 2932, in beam_search
outputs = self(
File "/home/czh/.conda/envs/sam/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/czh/.conda/envs/sam/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
return forward_call(*args, **kwargs)
File "/home/czh/UAP_VLP-main/models/XVLM/xbert.py", line 1311, in forward
outputs = self.bert(
File "/home/czh/.conda/envs/sam/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/czh/.conda/envs/sam/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
return forward_call(*args, **kwargs)
File "/home/czh/UAP_VLP-main/models/XVLM/xbert.py", line 1058, in forward
encoder_outputs = self.encoder(
File "/home/czh/.conda/envs/sam/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/czh/.conda/envs/sam/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
return forward_call(*args, **kwargs)
File "/home/czh/UAP_VLP-main/models/XVLM/xbert.py", line 603, in forward
layer_outputs = layer_module(
File "/home/czh/.conda/envs/sam/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/czh/.conda/envs/sam/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
return forward_call(*args, **kwargs)
File "/home/czh/UAP_VLP-main/models/XVLM/xbert.py", line 505, in forward
cross_attention_outputs = self.crossattention(
File "/home/czh/.conda/envs/sam/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/czh/.conda/envs/sam/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
return forward_call(*args, **kwargs)
File "/home/czh/UAP_VLP-main/models/XVLM/xbert.py", line 407, in forward
self_outputs = self.self(
File "/home/czh/.conda/envs/sam/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/czh/.conda/envs/sam/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
return forward_call(*args, **kwargs)
File "/home/czh/UAP_VLP-main/models/XVLM/xbert.py", line 306, in forward
attention_scores = torch.matmul(query_layer, key_layer.transpose(-1, -2))
RuntimeError: The size of tensor a (48) must match the size of tensor b (144) at non-singleton dimension 0

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