IDEA-Research / DINO

[ICLR 2023] Official implementation of the paper "DINO: DETR with Improved DeNoising Anchor Boxes for End-to-End Object Detection"
Apache License 2.0
2.19k stars 243 forks source link

ModuleNotFoundError: No module named 'MultiScaleDeformableAttention' #198

Open Ignite6666 opened 1 year ago

Ignite6666 commented 1 year ago

I have run setup.py before, and got this, thought this module has been installed successfully:

图片 But when I try to run test.py, I got this error. 图片

yigitatay commented 1 year ago

If you're running this on a notebook, restarting the kernel fixes this issue. You don't have to run the setup after you restart the kernel.

chuuhtetnaing commented 1 year ago

I've the same problem. In the models/dino/ops, I ran the python setup.py bdist_wheel to create the wheel first to the dist folder. Then, I installed the wheel manually from the dist using pip install MultiScaleDeformableAttention-1.0-cp39-cp39-linux_x86_64.whl.

xx025 commented 11 months ago

这个问题应该是编译 MultiScaleDeformableAttention 出现的问题,也就是在 编译CUDA 算子的时候没成功 image


下面是我的解决办法

1. 首先保证你的机器上已经配置好驱动和安装好CUDA Toolkit

可用下面的方式检查

  nvidia-smi
  nvcc -V

然后检查是否配置好CUDA_HOME ,这一步往往需要你手动设定

  $CUDA_HOME

设置办法是检查你安装的 CUDA_Tookit路径 如: /usr/local/cuda-11.6

然后编辑用户系统变量文件

  nano .bashrc

在文件末尾追加 CUDA_HOME

  如:export CUDA_HOME="/usr/local/cuda-11.6"

image

2. 然后安装与CUDA 相匹配的torch版本

如果首页没有就查看torch的历史版本,因为GPU 版本torch 与 Cuda 版本不匹配,编译的时候也可能会出问题

image

3. 最后重新编译CUDA 算子

cd models/dino/ops
python setup.py build install
# unit test (should see all checking is True)
python test.py
cd ../../..
SWHL commented 11 months ago

@xx025 感谢,这个解决了我的问题。