open-mmlab / mmdetection3d

OpenMMLab's next-generation platform for general 3D object detection.
https://mmdetection3d.readthedocs.io/en/latest/
Apache License 2.0
5k stars 1.49k forks source link

[Bug] RuntimeError: hard_voxelize_forward_impl: implementation for device cuda:0 not found. #2932

Closed tangX10086 closed 3 months ago

tangX10086 commented 3 months ago

Prerequisite

Task

I'm using the official example scripts/configs for the officially supported tasks/models/datasets.

Branch

1.x branch https://github.com/open-mmlab/mmdetection3d/tree/dev-1.x

Environment

sys.platform: linux Python: 3.8.19 (default, Mar 20 2024, 19:58:24) [GCC 11.2.0] CUDA available: True MUSA available: False numpy_random_seed: 2147483648 GPU 0: NVIDIA GeForce RTX 3060 Laptop GPU CUDA_HOME: /usr/local/cuda NVCC: Cuda compilation tools, release 11.8, V11.8.89 GCC: gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 PyTorch: 2.2.1+cu118 PyTorch compiling details: PyTorch built with:

TorchVision: 0.17.1+cu118 OpenCV: 4.9.0 MMEngine: 0.10.3 MMDetection: 3.3.0 MMDetection3D: 1.4.0+ spconv2.0: False

Reproduces the problem - code sample

I'm trying the example of GET STARTED

Reproduces the problem - command or script

python demo/pcd_demo.py demo/data/kitti/000008.bin pointpillars_hv_secfpn_8xb6-160e_kitti-3d-car.py hv_pointpillars_secfpn_6x8_160e_kitti-3d-car_20220331_134606-d42d15ed.pth --show

Reproduces the problem - error message

/home/guts/mmlab/mmdetection3d/mmdet3d/models/dense_heads/anchor3d_head.py:94: UserWarning: dir_offset and dir_limit_offset will be depressed and be incorporated into box coder in the future warnings.warn( Loads checkpoint by local backend from path: hv_pointpillars_secfpn_6x8_160e_kitti-3d-car_20220331_134606-d42d15ed.pth 03/23 10:50:13 - mmengine - WARNING - Failed to search registry with scope "mmdet3d" in the "function" registry tree. As a workaround, the current "function" registry in "mmengine" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmdet3d" is a correct scope, or whether the registry is initialized. /home/guts/anaconda3/envs/mmlab/lib/python3.8/site-packages/mmengine/visualization/visualizer.py:196: UserWarning: Failed to add <class 'mmengine.visualization.vis_backend.LocalVisBackend'>, please provide the save_dir argument. warnings.warn(f'Failed to add {vis_backend.class}, ' Inference ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Traceback (most recent call last): File "demo/pcd_demo.py", line 90, in main() File "demo/pcd_demo.py", line 80, in main inferencer(call_args) File "/home/guts/mmlab/mmdetection3d/mmdet3d/apis/inferencers/base_3d_inferencer.py", line 212, in call preds.extend(self.forward(data, forward_kwargs)) File "/home/guts/anaconda3/envs/mmlab/lib/python3.8/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context return func(*args, kwargs) File "/home/guts/anaconda3/envs/mmlab/lib/python3.8/site-packages/mmengine/infer/infer.py", line 296, in forward return self.model.test_step(inputs) File "/home/guts/anaconda3/envs/mmlab/lib/python3.8/site-packages/mmengine/model/base_model/base_model.py", line 144, in test_step data = self.data_preprocessor(data, False) File "/home/guts/anaconda3/envs/mmlab/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl return self._call_impl(*args, *kwargs) File "/home/guts/anaconda3/envs/mmlab/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl return forward_call(args, kwargs) File "/home/guts/mmlab/mmdetection3d/mmdet3d/models/data_preprocessors/data_preprocessor.py", line 152, in forward return self.simple_process(data, training) File "/home/guts/mmlab/mmdetection3d/mmdet3d/models/data_preprocessors/data_preprocessor.py", line 178, in simple_process voxel_dict = self.voxelize(inputs['points'], data_samples) File "/home/guts/anaconda3/envs/mmlab/lib/python3.8/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context return func(*args, kwargs) File "/home/guts/mmlab/mmdetection3d/mmdet3d/models/data_preprocessors/data_preprocessor.py", line 367, in voxelize res_voxels, res_coors, res_num_points = self.voxel_layer(res) File "/home/guts/anaconda3/envs/mmlab/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl return self._call_impl(*args, *kwargs) File "/home/guts/anaconda3/envs/mmlab/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl return forward_call(args, kwargs) File "/home/guts/mmlab/mmdetection3d/mmdet3d/models/data_preprocessors/voxelize.py", line 170, in forward return voxelization(input, self.voxel_size, self.point_cloud_range, File "/home/guts/anaconda3/envs/mmlab/lib/python3.8/site-packages/torch/autograd/function.py", line 553, in apply return super().apply(*args, **kwargs) # type: ignore[misc] File "/home/guts/mmlab/mmdetection3d/mmdet3d/models/data_preprocessors/voxelize.py", line 78, in forward ext_module.hard_voxelize_forward( RuntimeError: hard_voxelize_forward_impl: implementation for device cuda:0 not found.

Additional information

I have tried to fix the error following the #1413, but both of the two solutions of it did not work

tangX10086 commented 3 months ago

I have fixed this error by downgrading the pytorch version from 2.2 to 2.0

1163710216 commented 2 months ago

I also have fixed this error by downgrading the pytorch version from 2.2.2 to 2.1.0