RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 1 but got size 0 for tensor number 2 in the list.
Closed this issue · 5 comments
Hi. I am running the code with default setting and both no defense and robosac_mAP. However, I am getting the following error:
....
at epoch 49
/mnt/data/fare01/ROBOSAC/coperception/tools/det/robosac.py:168: RuntimeWarning: divide by zero encountered in log
N = np.ceil(np.log(1 - 0.99) / np.log(1 - np.power(1 - eta, num_consensus))).astype(int)
10%|████ | 800/8000 [01:36<12:41, 9.45it/s]
Scene 8, Frame 0:
10%|████ | 800/8000 [01:43<15:33, 7.71it/s]
Traceback (most recent call last):
File "/mnt/data/anaconda3/envs/amongus/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 171, in forward
python-BaseException
outputs = self.parallel_apply(replicas, inputs, kwargs)
File "/mnt/data/anaconda3/envs/amongus/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 181, in parallel_apply
return parallel_apply(replicas, inputs, kwargs, self.device_ids[:len(replicas)])
File "/mnt/data/anaconda3/envs/amongus/lib/python3.7/site-packages/torch/nn/parallel/parallel_apply.py", line 89, in parallel_apply
output.reraise()
File "/mnt/data/anaconda3/envs/amongus/lib/python3.7/site-packages/torch/_utils.py", line 543, in reraise
raise exception
RuntimeError: Caught RuntimeError in replica 0 on device 0.
Original Traceback (most recent call last):
File "/mnt/data/anaconda3/envs/amongus/lib/python3.7/site-packages/torch/nn/parallel/parallel_apply.py", line 64, in _worker
output = module(*input, **kwargs)
File "/mnt/data/anaconda3/envs/amongus/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "/mnt/data/fare01/ROBOSAC/coperception/coperception/models/det/base/FusionBase.py", line 116, in forward
feat_list
File "/mnt/data/fare01/ROBOSAC/coperception/coperception/models/det/base/DetModelBase.py", line 127, in build_local_communication_matrix
return torch.cat(tuple(feature_list), 1)
RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 1 but got size 0 for tensor number 2 in the list.
Could you please help me to figure out what is the problem?
@qifang-robotics @RoboticsYimingLi can you take a look at this? Thank you!
Hi Farzaneh,
From the error msg it seems that you may run the code with more than one GPU allocated. You can try running by specifying "CUDA_VISIBLE_DEVICES=0" at the beginning of your command.
If that fix still won't work, please put your complete command line to run the code here, so that we can debug on our end.
Hi Farzaneh,
From the error msg it seems that you may run the code with more than one GPU allocated. You can try running by specifying "CUDA_VISIBLE_DEVICES=0" at the beginning of your command.
If that fix still won't work, please put your complete command line to run the code here, so that we can debug on our end.
Hi, Thank you for your answer, I set CUDA_VISIBLE_DEVICES=0.
My command is:
CUDA_VISIBLE_DEVICES=0 python robosac.py --log --robosac no_defense --adv_iter 15 --number_of_attackers 2 --ego_agent 1
Sorry for the late response. I noticed that the dataset has 8000 samples, which should not be the case for the test set.
Could you please double-check if the downloaded dataset (https://drive.google.com/drive/folders/1zFK9VWvXvYUHatKod5PTl8kZxSFskGGE, V2X-Sim-det.zip) were correct, and ensure specifying the test set in --data argument of robosac.py (should be ".../V2X-Sim-det/test")?
Hi Farzaneh,
From the error msg it seems that you may run the code with more than one GPU allocated. You can try running by specifying "CUDA_VISIBLE_DEVICES=0" at the beginning of your command.
If that fix still won't work, please put your complete command line to run the code here, so that we can debug on our end.Hi, Thank you for your answer, I set CUDA_VISIBLE_DEVICES=0. My command is: CUDA_VISIBLE_DEVICES=0 python robosac.py --log --robosac no_defense --adv_iter 15 --number_of_attackers 2 --ego_agent 1
NP. I did it. It works fine now. Thanks
Sorry for the late response. I noticed that the dataset has 8000 samples, which should not be the case for the test set.
Could you please double-check if the downloaded dataset (https://drive.google.com/drive/folders/1zFK9VWvXvYUHatKod5PTl8kZxSFskGGE, V2X-Sim-det.zip) were correct, and ensure specifying the test set in --data argument of robosac.py (should be ".../V2X-Sim-det/test")?
Hi Farzaneh,
From the error msg it seems that you may run the code with more than one GPU allocated. You can try running by specifying "CUDA_VISIBLE_DEVICES=0" at the beginning of your command.
If that fix still won't work, please put your complete command line to run the code here, so that we can debug on our end.Hi, Thank you for your answer, I set CUDA_VISIBLE_DEVICES=0. My command is: CUDA_VISIBLE_DEVICES=0 python robosac.py --log --robosac no_defense --adv_iter 15 --number_of_attackers 2 --ego_agent 1