HZAI-ZJNU / Mamba-YOLO

the official pytorch implementation of “Mamba-YOLO:SSMs-based for Object Detection”
Apache License 2.0
147 stars 16 forks source link

error about selective_scan_cuda_core #13

Open CangHaiQingYue opened 2 weeks ago

CangHaiQingYue commented 2 weeks ago

hello, when I run code python mbyolo_train.py --task train --data ultralytics/cfg/datasets/coco.yaml \ --config ultralytics/cfg/models/v8/mamba-yolo.yaml \ --amp --project ./output_dir/mscoco --name mambayolo_n this error message appears File "/home/Mamba-YOLO-main/ultralytics/nn/modules/common_utils_mbyolo.py", line 128, in forward out, x, *rest = selective_scan_cuda_core.fwd(u.contiguous(), delta, A, B, C, D, delta_bias, delta_softplus, 1) RuntimeError: Expected u.is_cuda() to be true, but got false. (Could this error message be improved? If so, please report an enhancement request to PyTorch.)

how can I fix this? Thank you for your time.


My env is torch-2.3.0-cu12.1

EthanW-coder commented 2 weeks ago

Hello, this issue comes from the fact that you are using the default parameters for multi-GPU training in mbyolo_train.py. If you are training with only one GPU, could you please change parser.add_argument('--device', default='0,1,2,3,4,5,6,7', help='cuda device, i.e. 0 or 0,1,2,3 or cpu') to parser.add_argument('--device', default='0', help='cuda device, i.e. 0 or 0,1,2,3 or cpu') to parser.add_argument('--device', default='0', help='cuda device'). argument('--device', default='0', help='cuda device, i.e. 0 or 0,1,2,3 or cpu')

CangHaiQingYue commented 1 week ago

@EthanW-coder Thank you for responding so quickly! Sure. if I use only one GPU, this error will not appears. And if I want to multi-GPU, how can I fix this, since it's faster.