OpenGVLab / DCNv4

[CVPR 2024] Deformable Convolution v4
https://arxiv.org/pdf/2401.06197.pdf
MIT License
510 stars 27 forks source link

NotImplementedError #59

Open 18222why opened 4 months ago

18222why commented 4 months ago

Traceback (most recent call last): File "main.py", line 24, in from models import build_model File "/home/sd9t/stu24_why/work/classfication/DCNv4-main/classification/models/init.py", line 7, in from .build import build_model File "/home/sd9t/stu24_why/work/classfication/DCNv4-main/classification/models/build.py", line 9, in from .flash_intern_image import FlashInternImage File "/home/sd9t/stu24_why/work/classfication/DCNv4-main/classification/models/flash_intern_image.py", line 14, in import DCNv4 File "/home/sd9t/stu24_why/.conda/envs/internimage/lib/python3.7/site-packages/DCNv4/init.py", line 1, in from .functions import DCNv4Function, FlashDeformAttnFunction File "/home/sd9t/stu24_why/.conda/envs/internimage/lib/python3.7/site-packages/DCNv4/functions/init.py", line 10, in from .flash_deform_attn_func import FlashDeformAttnFunction File "/home/sd9t/stu24_why/.conda/envs/internimage/lib/python3.7/site-packages/DCNv4/functions/flash_deform_attn_func.py", line 34, in raise NotImplementedError NotImplementedError

HelyaHsiung commented 1 month ago

I have also meet this error.

import DCNv4
  File "/home/xhy23/miniconda3/envs/pytorch/lib/python3.8/site-packages/DCNv4-1.0.0.post2-py3.8-linux-x86_64.egg/DCNv4/__init__.py", line 1, in <module>
    from .functions import DCNv4Function, FlashDeformAttnFunction
  File "/home/xhy23/miniconda3/envs/pytorch/lib/python3.8/site-packages/DCNv4-1.0.0.post2-py3.8-linux-x86_64.egg/DCNv4/functions/__init__.py", line 10, in <module>
    from .flash_deform_attn_func import FlashDeformAttnFunction
  File "/home/xhy23/miniconda3/envs/pytorch/lib/python3.8/site-packages/DCNv4-1.0.0.post2-py3.8-linux-x86_64.egg/DCNv4/functions/flash_deform_attn_func.py", line 34, in <module>
    raise NotImplementedError
NotImplementedError

How to solve it. Please.

HelyaHsiung commented 3 weeks ago

I have found these code in file functions/flash_deform_attn_func.py:

shm_size_dict = {
    "8.0": 163000,
    "8.6": 99000,
    "8.7": 163000,
    "8.9": 99000,
    "9.0": 227000,
    "7.5": 64000,
    "7.0": 96000,
}

cuda_capability = f"{torch.cuda.get_device_properties(0).major}.{torch.cuda.get_device_properties(0).minor}"

if cuda_capability not in shm_size_dict:
    raise NotImplementedError

shm_size_cap = shm_size_dict[cuda_capability]

It seem that author have specified the minmum and maximum version of NVIDIA GPU to support DCNv4.

So, if you meet error like "NotImplementedError", you may compile DCNv4 on cpu or early GPU than 7.0.

We can use such codes to check the version of GPU:

import torch
print(f"{torch.cuda.get_device_properties(0).major}.{torch.cuda.get_device_properties(0).minor}")

You can switch a GPU device or add your GPU version into shm_size_dict. But GPU with too small shared memory may raise new error.