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

error #121

Open
onismera opened this issue Nov 13, 2024 · 9 comments
Open

error #121

onismera opened this issue Nov 13, 2024 · 9 comments

Comments

@onismera
Copy link

/pytorch/aten/src/THCUNN/SpatialClassNLLCriterion.cu:106: cunn_SpatialClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [160,0,0] Assertion t >= 0 && t < n_classes failed.
/pytorch/aten/src/THCUNN/SpatialClassNLLCriterion.cu:106: cunn_SpatialClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [161,0,0] Assertion t >= 0 && t < n_classes failed.
/pytorch/aten/src/THCUNN/SpatialClassNLLCriterion.cu:106: cunn_SpatialClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [162,0,0] Assertion t >= 0 && t < n_classes failed.
/pytorch/aten/src/THCUNN/SpatialClassNLLCriterion.cu:106: cunn_SpatialClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [163,0,0] Assertion t >= 0 && t < n_classes failed.
/pytorch/aten/src/THCUNN/SpatialClassNLLCriterion.cu:106: cunn_SpatialClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [164,0,0] Assertion t >= 0 && t < n_classes failed.
/pytorch/aten/src/THCUNN/SpatialClassNLLCriterion.cu:106: cunn_SpatialClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [165,0,0] Assertion t >= 0 && t < n_classes failed.
/pytorch/aten/src/THCUNN/SpatialClassNLLCriterion.cu:106: cunn_SpatialClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [166,0,0] Assertion t >= 0 && t < n_classes failed.
/pytorch/aten/src/THCUNN/SpatialClassNLLCriterion.cu:106: cunn_SpatialClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [167,0,0] Assertion t >= 0 && t < n_classes failed.
/pytorch/aten/src/THCUNN/SpatialClassNLLCriterion.cu:106: cunn_SpatialClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [168,0,0] Assertion t >= 0 && t < n_classes failed.
/pytorch/aten/src/THCUNN/SpatialClassNLLCriterion.cu:106: cunn_SpatialClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [169,0,0] Assertion t >= 0 && t < n_classes failed.
/pytorch/aten/src/THCUNN/SpatialClassNLLCriterion.cu:106: cunn_SpatialClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [170,0,0] Assertion t >= 0 && t < n_classes failed.
/pytorch/aten/src/THCUNN/SpatialClassNLLCriterion.cu:106: cunn_SpatialClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [171,0,0] Assertion t >= 0 && t < n_classes failed.
/pytorch/aten/src/THCUNN/SpatialClassNLLCriterion.cu:106: cunn_SpatialClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [172,0,0] Assertion t >= 0 && t < n_classes failed.
/pytorch/aten/src/THCUNN/SpatialClassNLLCriterion.cu:106: cunn_SpatialClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [173,0,0] Assertion t >= 0 && t < n_classes failed.
/pytorch/aten/src/THCUNN/SpatialClassNLLCriterion.cu:106: cunn_SpatialClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [174,0,0] Assertion t >= 0 && t < n_classes failed.
/pytorch/aten/src/THCUNN/SpatialClassNLLCriterion.cu:106: cunn_SpatialClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [175,0,0] Assertion t >= 0 && t < n_classes failed.
/pytorch/aten/src/THCUNN/SpatialClassNLLCriterion.cu:106: cunn_SpatialClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [176,0,0] Assertion t >= 0 && t < n_classes failed.
/pytorch/aten/src/THCUNN/SpatialClassNLLCriterion.cu:106: cunn_SpatialClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [177,0,0] Assertion t >= 0 && t < n_classes failed.
/pytorch/aten/src/THCUNN/SpatialClassNLLCriterion.cu:106: cunn_SpatialClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [178,0,0] Assertion t >= 0 && t < n_classes failed.
/pytorch/aten/src/THCUNN/SpatialClassNLLCriterion.cu:106: cunn_SpatialClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [179,0,0] Assertion t >= 0 && t < n_classes failed.
/pytorch/aten/src/THCUNN/SpatialClassNLLCriterion.cu:106: cunn_SpatialClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [180,0,0] Assertion t >= 0 && t < n_classes failed.
/pytorch/aten/src/THCUNN/SpatialClassNLLCriterion.cu:106: cunn_SpatialClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [181,0,0] Assertion t >= 0 && t < n_classes failed.
/pytorch/aten/src/THCUNN/SpatialClassNLLCriterion.cu:106: cunn_SpatialClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [182,0,0] Assertion t >= 0 && t < n_classes failed.
/pytorch/aten/src/THCUNN/SpatialClassNLLCriterion.cu:106: cunn_SpatialClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [183,0,0] Assertion t >= 0 && t < n_classes failed.
/pytorch/aten/src/THCUNN/SpatialClassNLLCriterion.cu:106: cunn_SpatialClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [184,0,0] Assertion t >= 0 && t < n_classes failed.
/pytorch/aten/src/THCUNN/SpatialClassNLLCriterion.cu:106: cunn_SpatialClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [185,0,0] Assertion t >= 0 && t < n_classes failed.
/pytorch/aten/src/THCUNN/SpatialClassNLLCriterion.cu:106: cunn_SpatialClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [186,0,0] Assertion t >= 0 && t < n_classes failed.
/pytorch/aten/src/THCUNN/SpatialClassNLLCriterion.cu:106: cunn_SpatialClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [187,0,0] Assertion t >= 0 && t < n_classes failed.
/pytorch/aten/src/THCUNN/SpatialClassNLLCriterion.cu:106: cunn_SpatialClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [188,0,0] Assertion t >= 0 && t < n_classes failed.
/pytorch/aten/src/THCUNN/SpatialClassNLLCriterion.cu:106: cunn_SpatialClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [189,0,0] Assertion t >= 0 && t < n_classes failed.
/pytorch/aten/src/THCUNN/SpatialClassNLLCriterion.cu:106: cunn_SpatialClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [190,0,0] Assertion t >= 0 && t < n_classes failed.
/pytorch/aten/src/THCUNN/SpatialClassNLLCriterion.cu:106: cunn_SpatialClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [191,0,0] Assertion t >= 0 && t < n_classes failed.
0%| | 0/150 [00:01<?, ?it/s]
Traceback (most recent call last):
File "train.py", line 101, in
trainer_synapse(args, net, args.output_dir)
File "/mnt/C/znmd_ztc/ReID/Swin-Unet-main/trainer.py", line 68, in trainer_synapse
loss_dice = dice_loss(outputs, label_batch, softmax=True)
File "/mnt/C/znmd_ztc/anaconda3/envs/Swin-Unet-main/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/mnt/C/znmd_ztc/ReID/Swin-Unet-main/utils.py", line 43, in forward
class_wise_dice.append(1.0 - dice.item())
RuntimeError: CUDA error: device-side assert triggered
Hello, I encountered this problem while reproducing the model. Do you have a solution?

@aixiaobaikkk
Copy link

you need set args.n_class = 9

@yjq-yes
Copy link

yjq-yes commented Nov 21, 2024

Sorry to disrupt. I encountered the same problem and I've set it to 9, but it doesn't change.
python train.py --dataset Synapse --cfg configs/swin_tiny_patch4_window7_224_lite.yaml --root_path "data/Synapse/" --max_epochs 150 --output_dir "output" --img_size 224 --base_lr 0.05 --batch_size 6 --num_classes 9:

:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [3,0,0], thread: [353,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [3,0,0], thread: [354,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [3,0,0], thread: [355,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [3,0,0], thread: [356,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [672,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [673,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [448,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [449,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [3,0,0], thread: [576,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [3,0,0], thread: [577,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [3,0,0], thread: [578,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [3,0,0], thread: [579,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [3,0,0], thread: [580,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [3,0,0], thread: [581,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [3,0,0], thread: [582,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [3,0,0], thread: [583,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [224,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [3,0,0], thread: [894,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [3,0,0], thread: [895,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [951,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [952,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [953,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [954,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [955,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [190,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [191,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [635,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [636,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [637,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [638,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [639,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [4,0,0], thread: [580,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [4,0,0], thread: [581,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [857,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [858,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [859,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [860,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [861,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [862,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [863,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [413,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [414,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [415,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [502,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [503,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [504,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [505,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [506,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [507,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [508,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [509,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [510,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [511,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [4,0,0], thread: [802,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [4,0,0], thread: [803,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [4,0,0], thread: [804,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [4,0,0], thread: [805,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [4,0,0], thread: [806,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [4,0,0], thread: [0,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [4,0,0], thread: [1,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [4,0,0], thread: [2,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [4,0,0], thread: [3,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [4,0,0], thread: [4,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [4,0,0], thread: [5,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [4,0,0], thread: [6,0,0] Assertion t >= 0 && t < n_classes failed.
C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [4,0,0], thread: [7,0,0] Assertion t >= 0 && t < n_classes failed.
0%| | 0/150 [00:29<?, ?it/s]
Traceback (most recent call last):
File "E:\Swin-Unet-main\Swin-Unet-main\train.py", line 101, in
trainer_synapse(args, net, args.output_dir)
File "E:\Swin-Unet-main\Swin-Unet-main\trainer.py", line 68, in trainer_synapse
loss_dice = dice_loss(outputs, label_batch, softmax=True)
File "E:\anaconda\envs\DL\lib\site-packages\torch\nn\modules\module.py", line 1736, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "E:\anaconda\envs\DL\lib\site-packages\torch\nn\modules\module.py", line 1747, in _call_impl
return forward_call(*args, **kwargs)
File "E:\Swin-Unet-main\Swin-Unet-main\utils.py", line 35, in forward
target = self._one_hot_encoder(target)
File "E:\Swin-Unet-main\Swin-Unet-main\utils.py", line 17, in _one_hot_encoder
temp_prob = input_tensor == i # * torch.ones_like(input_tensor)
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
Compile with TORCH_USE_CUDA_DSA to enable device-side assertions.

@onismera
Copy link
Author

Sorry to disrupt. I encountered the same problem and I've set it to 9, but it doesn't change. python train.py --dataset Synapse --cfg configs/swin_tiny_patch4_window7_224_lite.yaml --root_path "data/Synapse/" --max_epochs 150 --output_dir "output" --img_size 224 --base_lr 0.05 --batch_size 6 --num_classes 9:

:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [3,0,0], thread: [353,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [3,0,0], thread: [354,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [3,0,0], thread: [355,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [3,0,0], thread: [356,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [672,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [673,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [448,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [449,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [3,0,0], thread: [576,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [3,0,0], thread: [577,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [3,0,0], thread: [578,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [3,0,0], thread: [579,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [3,0,0], thread: [580,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [3,0,0], thread: [581,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [3,0,0], thread: [582,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [3,0,0], thread: [583,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [224,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [3,0,0], thread: [894,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [3,0,0], thread: [895,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [951,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [952,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [953,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [954,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [955,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [190,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [191,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [635,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [636,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [637,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [638,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [639,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [4,0,0], thread: [580,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [4,0,0], thread: [581,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [857,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [858,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [859,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [860,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [861,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [862,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [863,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [413,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [414,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [415,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [502,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [503,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [504,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [505,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [506,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [507,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [508,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [509,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [510,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [2,0,0], thread: [511,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [4,0,0], thread: [802,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [4,0,0], thread: [803,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [4,0,0], thread: [804,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [4,0,0], thread: [805,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [4,0,0], thread: [806,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [4,0,0], thread: [0,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [4,0,0], thread: [1,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [4,0,0], thread: [2,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [4,0,0], thread: [3,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [4,0,0], thread: [4,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [4,0,0], thread: [5,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [4,0,0], thread: [6,0,0] Assertion t >= 0 && t < n_classes failed. C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\NLLLoss2d.cu:106: block: [4,0,0], thread: [7,0,0] Assertion t >= 0 && t < n_classes failed. 0%| | 0/150 [00:29<?, ?it/s] Traceback (most recent call last): File "E:\Swin-Unet-main\Swin-Unet-main\train.py", line 101, in trainer_synapse(args, net, args.output_dir) File "E:\Swin-Unet-main\Swin-Unet-main\trainer.py", line 68, in trainer_synapse loss_dice = dice_loss(outputs, label_batch, softmax=True) File "E:\anaconda\envs\DL\lib\site-packages\torch\nn\modules\module.py", line 1736, in _wrapped_call_impl return self._call_impl(*args, **kwargs) File "E:\anaconda\envs\DL\lib\site-packages\torch\nn\modules\module.py", line 1747, in _call_impl return forward_call(*args, **kwargs) File "E:\Swin-Unet-main\Swin-Unet-main\utils.py", line 35, in forward target = self._one_hot_encoder(target) File "E:\Swin-Unet-main\Swin-Unet-main\utils.py", line 17, in _one_hot_encoder temp_prob = input_tensor == i # * torch.ones_like(input_tensor) 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 Compile with TORCH_USE_CUDA_DSA to enable device-side assertions.

是调整n_class的值为9,num_class和n_class是两个不同的参数,都要设置为9才可以

@onismera
Copy link
Author

you need set args.n_class = 9

Thank you for your answer. The problem has been solved so far, but my final test results are 3-4 percentage points lower than those in the paper, and the visualization results are also poor and jagged. Overall, they are not as good as transunet. How should this problem be solved?

@onismera
Copy link
Author

you need set args.n_class = 9

Thank you for your answer. The problem has been solved so far, but my final test results are 3-4 percentage points lower than those in the paper, and the visualization results are also poor and jagged. Overall, they are not as good as transunet. How should this problem be solved?

that‘s noraml,I can't reproduce it, and of course many other people have reproduced it. Under this framework, the results of unet are better than this, so you know...

hahahaha,Understood, it seems like I also need to do some tricks

@yjq-yes
Copy link

yjq-yes commented Nov 21, 2024

可以!解决了!谢谢哥们

@onismera
Copy link
Author

可以!解决了!谢谢哥们

ok的,你训练测试完之后把你的测试指标发给俺瞅瞅,我复现的比论文低了3-4个点,可视化结果也不太行

@HuCaoFighting
Copy link
Owner

SwinUnet has already been extensively tested and validated by numerous researchers. Its performance has consistently proven to be superior to U-Net and TransUNet on widely recognized benchmarks such as Synapse and ISIC datasets.

I kindly request that you carefully review the provided codes and avoid making unsubstantiated or negative comments about the method.

@aixiaobaikkk
Copy link

SwinUnet has already been extensively tested and validated by numerous researchers. Its performance has consistently proven to be superior to U-Net and TransUNet on widely recognized benchmarks such as Synapse and ISIC datasets.

I kindly request that you carefully review the provided codes and avoid making unsubstantiated or negative comments about the method.

Sorry, I am very sure of your contribution. As the first unet model with a pure Transformer structure, it has given me a lot of encouragement. I did not mean to give you a negative review. I will check my code carefully and apologize to you again.

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