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

关于您该项目的实验 #99

Closed
Secret813 opened this issue Nov 27, 2023 · 3 comments
Closed

关于您该项目的实验 #99

Secret813 opened this issue Nov 27, 2023 · 3 comments

Comments

@Secret813
Copy link

您好,我想对您的项目做一些实验,增加了一个模块用到了
def label_onehot(inputs, num_segments): batch_size, im_h, im_w = inputs.shape # remap invalid pixels (-1) into 0, otherwise we cannot create one-hot vector with negative labels. # we will still mask out those invalid values in valid mask inputs = torch.relu(inputs) outputs = torch.zeros([batch_size, num_segments, im_h, im_w]).to(inputs.device) return outputs.scatter_(1, inputs.unsqueeze(1), 1.0)
这一函数。运行的时候报错RuntimeError: CUDA error: device-side assert triggered
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1. 定位后报错出现在了上面这段函数。具体为:
File "unimatch.py", line 288, in <module> main() File "unimatch.py", line 209, in main mask_l = F.interpolate(label_onehot(mask_x, 19),size=preds.shape[2:], mode='nearest') File "/root/UniMatch2/supervised.py", line 95, in label_onehot return outputs.scatter_(1, inputs.unsqueeze(1), 1.0) RuntimeError: CUDA error: device-side assert triggered请问您知道如何解决嘛?

@Secret813
Copy link
Author

[2023-11-27 18:16:25,627][ INFO] ===========> Epoch: 0, LR: 0.00500, Previous best: 0.00
../aten/src/ATen/native/cuda/ScatterGatherKernel.cu:365: operator(): block: [1104,0,0], thread: [64,0,0] Assertion idx_dim >= 0 && idx_dim < index_size && "index out of bounds" failed.
../aten/src/ATen/native/cuda/ScatterGatherKernel.cu:365: operator(): block: [1104,0,0], thread: [65,0,0] Assertion idx_dim >= 0 && idx_dim < index_size && "index out of bounds" failed.

@LiheYoung
Copy link
Owner

这应该是你希望scatter的类别的index大于了你one-hot规定的最大的类别(最大类别index似乎是18?(19-1)),可以检查一下你的inputs这个变量

@Secret813
Copy link
Author

非常感谢!

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