Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

AttributeError: 'list' object has no attribute 'numel' #1326

Open
gzgz-code opened this issue Oct 14, 2021 · 1 comment
Open

AttributeError: 'list' object has no attribute 'numel' #1326

gzgz-code opened this issue Oct 14, 2021 · 1 comment

Comments

@gzgz-code
Copy link

🐛 Bug

To Reproduce

Steps to reproduce the behavior:

Expected behavior

Traceback (most recent call last):
File "/home/hyh/software/pycharm-community-2021.2.1/plugins/python-ce/helpers/pydev/pydevd.py", line 1483, in exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "/home/hyh/software/pycharm-community-2021.2.1/plugins/python-ce/helpers/pydev/pydev_imps/pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/home/hyh/Code/python/CL/CL_OBJECT_DETECTION/copy/maskrcnn-benchmark/tools/train_net.py", line 266, in
main()
File "/home/hyh/Code/python/CL/CL_OBJECT_DETECTION/copy/maskrcnn-benchmark/tools/train_net.py", line 259, in main
model = train(cfg, args.local_rank, args.distributed)
File "/home/hyh/Code/python/CL/CL_OBJECT_DETECTION/copy/maskrcnn-benchmark/tools/train_net.py", line 157, in train
do_train(model, data_loader, optimizer, scheduler, checkpointer, device, checkpoint_period, arguments, summary_writer)
File "/home/hyh/Code/python/CL/CL_OBJECT_DETECTION/copy/maskrcnn-benchmark/tools/train_net.py", line 77, in do_train
loss_dict,
,
,
,_ = model(images, targets)
File "/home/hyh/anaconda3/envs/maskrcnn/lib/python3.8/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/hyh/anaconda3/envs/maskrcnn/lib/python3.8/site-packages/apex-0.1-py3.8-linux-x86_64.egg/apex/amp/_initialize.py", line 196, in new_fwd
output = old_fwd(*applier(args, input_caster),
File "/home/hyh/Code/python/CL/CL_OBJECT_DETECTION/copy/maskrcnn-benchmark/maskrcnn_benchmark/modeling/detector/generalized_rcnn.py", line 62, in forward
features, backbone_features = self.backbone(images.tensors)
File "/home/hyh/anaconda3/envs/maskrcnn/lib/python3.8/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/hyh/anaconda3/envs/maskrcnn/lib/python3.8/site-packages/torch/nn/modules/container.py", line 117, in forward
input = module(input)
File "/home/hyh/anaconda3/envs/maskrcnn/lib/python3.8/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/hyh/Code/python/CL/CL_OBJECT_DETECTION/copy/maskrcnn-benchmark/maskrcnn_benchmark/modeling/backbone/fpn.py", line 51, in forward
last_inner = getattr(self, self.inner_blocks[-1])(x[-1])
File "/home/hyh/anaconda3/envs/maskrcnn/lib/python3.8/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/hyh/Code/python/CL/CL_OBJECT_DETECTION/copy/maskrcnn-benchmark/maskrcnn_benchmark/layers/misc.py", line 32, in forward
if x.numel() > 0:
AttributeError: 'list' object has no attribute 'numel'

Process finished with exit code 1

Environment

Please copy and paste the output from the
environment collection script from PyTorch
(or fill out the checklist below manually).

You can get the script and run it with:

wget https://raw.githubusercontent.com/pytorch/pytorch/master/torch/utils/collect_env.py
# For security purposes, please check the contents of collect_env.py before running it.
python collect_env.py
  • PyTorch Version (e.g., 1.0):1.6.0
  • OS (e.g., Linux):ubuntu
  • How you installed PyTorch (conda, pip, source):conda
  • Build command you used (if compiling from source):--config-file "/home/hyh/Code/python/CL/CL_OBJECT_DETECTION/copy/maskrcnn-benchmark/configs/e2e_mask_rcnn_R_50_FPN_1x.yaml" SOLVER.IMS_PER_BATCH 2 SOLVER.BASE_LR 0.0025 SOLVER.MAX_ITER 720000 SOLVER.STEPS "(480000, 640000)" TEST.IMS_PER_BATCH 1 MODEL.RPN.FPN_POST_NMS_TOP_N_TRAIN 2000
  • Python version:3.8
  • CUDA/cuDNN version:10.1
  • GPU models and configuration:GTX2080
  • Any other relevant information:

Additional context

I don't understand why such a mistake happened. If someone can help me, I'm very grateful

@chenfangchenf
Copy link

Did you solve this problem, I have the same problem

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

No branches or pull requests

2 participants