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

set randomness= dict(seed=138011772,deterministic=True) in config file, RuntimeError in anchor_head.py #11799

Open
ttt0666 opened this issue Jun 18, 2024 · 0 comments
Assignees

Comments

@ttt0666
Copy link

ttt0666 commented Jun 18, 2024

When I train Faster-rcnn with the following setting in config file:

randomness= dict(seed=138011772,deterministic=True)

I get the following error:

  File "/mmdetection-main/mmdet/models/dense_heads/anchor_head.py", line 505, in loss_by_feat
    cls_reg_targets = self.get_targets(
  File "/mmdetection-main/mmdet/models/dense_heads/anchor_head.py", line 381, in get_targets
    results = multi_apply(
  File "/mmdetection-main/mmdet/models/utils/misc.py", line 219, in multi_apply
    return tuple(map(list, zip(*map_results)))
  File "/mmdetection-main/mmdet/models/dense_heads/anchor_head.py", line 286, in _get_targets_single
    bbox_weights[pos_inds, :] = 1.0
RuntimeError: linearIndex.numel()*sliceSize*nElemBefore == expandedValue.numel() INTERNAL ASSERT FAILED at "../aten/src/ATen/native/cuda/Indexing.cu":389, please report a bug to PyTorch. number of flattened indices did not match number of elements in the value tensor: 12 vs 3

and I try to change

bbox_weights[pos_inds, :] = 1.0

in anchor_head.py to

bbox_weights[pos_inds, :] = 1 * torch.ones((len(pos_inds), bbox_weights.size(1)), device=bbox_weights.device)

the error disappears. Is this related to the randomness?

Also, I remove the deterministic=True as:

randomness= dict(seed=138011772)

the error also disappears.

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

2 participants