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

RuntimeError: The size of tensor a (256) must match the size of tensor b (225) at non-singleton dimension 1 #2

Open
xiaoqiang-lu opened this issue Feb 18, 2023 · 6 comments

Comments

@xiaoqiang-lu
Copy link

Dear author:
Thanks for your meaning work. During inference, I met 'RuntimeError: The size of tensor a (256) must match the size of tensor b (225) at non-singleton dimension 1'.

@hust-nj
Copy link
Member

hust-nj commented Feb 25, 2023

Hi, could you provide your test comand?

@xiaoqiang-lu
Copy link
Author

It occurred in online eval. config file: swinv2b_480reso_parallel_depthonly.py

Traceback (most recent call last):
File "code/train.py", line 270, in
main()
File "code/train.py", line 266, in main
runner.run(dataloaders)
File "/root/data3/DFC23/code/Track2/AiT/ait/code/runner/iter_based_runner_multitask.py", line 139, in run
self.train(iter_loaders)
File "/root/data3/DFC23/code/Track2/AiT/ait/code/runner/iter_based_runner_multitask.py", line 77, in train
self.call_hook('after_train_iter')
File "/root/miniconda3/envs/ait/lib/python3.7/site-packages/mmcv/runner/base_runner.py", line 309, in call_hook
getattr(hook, fn_name)(self)
File "/root/data3/DFC23/code/Track2/AiT/ait/code/model/eval.py", line 178, in after_train_iter
self._do_evaluate(runner)
File "/root/data3/DFC23/code/Track2/AiT/ait/code/model/eval.py", line 259, in _do_evaluate
logger=runner.logger)
File "/root/data3/DFC23/code/Track2/AiT/ait/code/model/eval.py", line 56, in multi_gpu_test
rescale=True, task=task, **data)
File "/root/miniconda3/envs/ait/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/root/miniconda3/envs/ait/lib/python3.7/site-packages/torch/nn/parallel/distributed.py", line 886, in forward
output = self.module(*inputs[0], **kwargs[0])
File "/root/miniconda3/envs/ait/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/root/miniconda3/envs/ait/lib/python3.7/site-packages/mmcv/runner/fp16_utils.py", line 109, in new_func
return old_func(*args, **kwargs)
File "/root/data3/DFC23/code/Track2/AiT/ait/code/model/ait.py", line 257, in forward
return self.forward_test(img, **kwargs)
File "/root/data3/DFC23/code/Track2/AiT/ait/code/model/ait.py", line 225, in forward_test
pred_d = self.depth_head.simple_test(feat, **kwargs).unsqueeze(1)
File "/root/data3/DFC23/code/Track2/AiT/ait/code/model/depth/depth_head.py", line 69, in simple_test
x, None, masks, self.task_id, pred_len=self.vae_cfg.token_length)
File "/root/miniconda3/envs/ait/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/root/miniconda3/envs/ait/lib/python3.7/site-packages/mmcv/runner/fp16_utils.py", line 197, in new_func
return old_func(*args, **kwargs)
File "/root/data3/DFC23/code/Track2/AiT/ait/code/model/transformer.py", line 307, in forward
if self.qk_pos else self.encoder(src + enc_embed, None, enc_mask)
RuntimeError: The size of tensor a (256) must match the size of tensor b (225) at non-singleton dimension 1

@cvrookieytd
Copy link

Hello. Have you succeeded in reproducing?

@xiaoqiang-lu
Copy link
Author

No, it still exists.

@cvrookieytd
Copy link

I have evaluated the model trained by the author. The evaluated model is AiT-P(SwinV2-L), and the task is depth estimation.

But there is a big gap between the results and what the author said. I don't know if there is a problem with my operation

@glofru
Copy link

glofru commented Aug 26, 2023

Hi @cvrookieytd can you tell me which version of CUDA/Python and packages were you able to evaluate the model? I am struggling in run an evaluation without getting an error. Thanks!

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

4 participants