facebookresearch / detectron2

Detectron2 is a platform for object detection, segmentation and other visual recognition tasks.
https://detectron2.readthedocs.io/en/latest/
Apache License 2.0
29.3k stars 7.32k forks source link

@torch.compiler.disable - AttributeError: module 'torch' has no attribute 'compiler' #5268

Open sebastianfernandezgarcia opened 2 months ago

sebastianfernandezgarcia commented 2 months ago

Instructions To Reproduce the ๐Ÿ› Bug:

  1. Full runnable code or full changes you made: In: detectron2/layers/nms.py''' and '''detectron2/layers/roi_align_rotated.py There is a new commit: '''181aae3'''

has included: +@torch.compiler.disable

(see commit changes)

So, with torch==1.11.0 torchvision==0.12.0 (I am using them to run DiT) the code says now:

23 # Note: this function (nms_rotated) might be moved into 24 # torchvision/ops/boxes.py in the future ---> 25 @torch.compiler.disable 26 def nms_rotated(boxes: torch.Tensor, scores: torch.Tensor, iou_threshold: float): 27 """ AttributeError: module 'torch' has no attribute 'compiler'
  1. What exact command you run:
  2. Full logs or other relevant observations:
    Error now with the code and version of torch

Expected behavior:

It should work. Since this comit, everthing is failing!

Environment:

I am using google colab
RenaYoyo commented 2 months ago

The latest v0.6 is different from the previous v0.6. You can install the previous one to solve this problem, like pip install 'git+https://github.com/facebookresearch/detectron2.git@v0.6'

vincent-legoll commented 2 months ago

Or you can take the code from just before the commit that broke it: pip install 'git+https://github.com/facebookresearch/detectron2.git@a59f05630a8f205756064244bf5beb8661f96180' That's the workaround I used for LabGym.

vvvvabc commented 2 months ago

I have the same problem you have. I use torch==2.0.0. I find torch.compiler.disable is used in pytorch versions 2.2 and above.you can upgrade you pytorch versions or try to change your detectron2 version. I solve this problom by upgrading torch==2.2.0.

Marlod390 commented 2 months ago

Or you can take the code from just before the commit that broke it: pip install 'git+https://github.com/facebookresearch/detectron2.git@a59f05630a8f205756064244bf5beb8661f96180' That's the workaround I used for LabGym.

I am using torch==2.0.0 and this works for me. Donโ€™t forget to uninstall the current detecron2 before executing the command, otherwise an error will still appear.

mancubus77 commented 2 months ago

Just wondering what CUDA versions and drivers are you using guys? Doco is outdated, and has no info about latest versions

ChrsBaur commented 2 months ago

I have the same problem you have. I use torch==2.0.0. I find torch.compiler.disable is used in pytorch versions 2.2 and above.you can upgrade you pytorch versions or try to change your detectron2 version. I solve this problom by upgrading torch==2.2.0.

What CUDA Version are you using? @vvvvabc @Marlod390 ? I have the same issue.

Marlod390 commented 2 months ago

@ChrsBaur cuda11.8