lab4d icon indicating copy to clipboard operation
lab4d copied to clipboard

[Bug/issue] AttributeError: module 'torch' has no attribute 'compiler'

Open randomx207 opened this issue 1 year ago • 1 comments

Describe the bug I have already set up the environment and can correctly run the content in Tutorial 2. However, when I try to run the content in Tutorial 5 (Pre-process custom videos), I encounter an error: module 'torch' has no attribute 'compiler'.

To Reproduce Run the command python scripts/run_preprocess.py cat-pikachu-0 cat quad "0"

Screenshots

Traceback (most recent call last):
  File "/media/data/_project/animal/lab4d/scripts/run_preprocess.py", line 15, in <module>
    from preprocess.scripts.canonical_registration import canonical_registration
  File "/media/data/_project/animal/lab4d/preprocess/scripts/canonical_registration.py", line 33, in <module>
    from viewpoint.dp_viewpoint import ViewponitNet
  File "/media/data/_project/animal/lab4d/preprocess/scripts/../third_party/viewpoint/dp_viewpoint.py", line 18, in <module>
    from viewpoint.cselib import create_cse, run_cse
  File "/media/data/_project/animal/lab4d/preprocess/scripts/../third_party/viewpoint/cselib.py", line 10, in <module>
    from detectron2.modeling import build_model
  File "/home/user/anaconda3/envs/xlab4/lib/python3.9/site-packages/detectron2/modeling/__init__.py", line 2, in <module>
    from detectron2.layers import ShapeSpec
  File "/home/user/anaconda3/envs/xlab4/lib/python3.9/site-packages/detectron2/layers/__init__.py", line 5, in <module>
    from .nms import batched_nms, batched_nms_rotated, nms, nms_rotated
  File "/home/user/anaconda3/envs/xlab4/lib/python3.9/site-packages/detectron2/layers/nms.py", line 25, in <module>
    @torch.compiler.disable
AttributeError: module 'torch' has no attribute 'compiler'

randomx207 avatar Apr 25 '24 06:04 randomx207

This is caused by a recent detectron2 update. I've locked the version in https://github.com/lab4d-org/lab4d/commit/dae4b47066fbb928650a827ef432d62301a42cb9. Updating to the latest repo and reinstall lab4d should work.

I also noticed it imports a different version of detectron2 Screenshot_2024-04-27_20-32-40 The path to be imported should be

...conda-path/envs/lab4d/lib/python3.9/site-packages/detectron2

so you might want to remove it from the python path

gengshan-y avatar Apr 28 '24 01:04 gengshan-y