yrcong / STTran

Spatial-Temporal Transformer for Dynamic Scene Graph Generation, ICCV2021
MIT License
181 stars 34 forks source link

Problem with torch.utils.ffi #30

Closed RRuschel closed 2 years ago

RRuschel commented 2 years ago

Hello,

I am trying to run your code but I'm coming across some issues regarding torch.utils.ffi. I compiled the draw_rectangles, fpn. Then compiled faster rcnn as instructed and copied the files over the fasterRCNN folder inside STTran, but when I try to run the code as it tries to resolve all the dependencies from line 10 on test.py from lib.object_detector import detector it crashes with the following error:

File "/media/hdd5/raphael/HOI/STTran/test.py", line 10, in from lib.object_detector import detector File "/media/hdd5/raphael/HOI/STTran/lib/object_detector.py", line 10, in from fasterRCNN.lib.model.faster_rcnn.resnet import resnet File "/media/hdd5/raphael/HOI/STTran/fasterRCNN/lib/model/faster_rcnn/resnet.py", line 6, in from fasterRCNN.lib.model.faster_rcnn.faster_rcnn import _fasterRCNN File "/media/hdd5/raphael/HOI/STTran/fasterRCNN/lib/model/faster_rcnn/faster_rcnn.py", line 10, in from model.rpn.rpn import _RPN File "/media/hdd5/raphael/HOI/STTran/fasterRCNN/lib/model/rpn/rpn.py", line 8, in from .proposal_layer import _ProposalLayer File "/media/hdd5/raphael/HOI/STTran/fasterRCNN/lib/model/rpn/proposal_layer.py", line 20, in from model.nms.nms_wrapper import nms File "/media/hdd5/raphael/HOI/STTran/fasterRCNN/lib/model/nms/nms_wrapper.py", line 10, in from model.nms.nms_gpu import nms_gpu File "/media/hdd5/raphael/HOI/STTran/fasterRCNN/lib/model/nms/nms_gpu.py", line 4, in from ._ext import nms File "/media/hdd5/raphael/HOI/STTran/fasterRCNN/lib/model/nms/_ext/nms/init.py", line 2, in from torch.utils.ffi import _wrap_function File "/media/hdd5/raphael/HOI/HOI_env/lib/python3.8/site-packages/torch/utils/ffi/init.py", line 1, in raise ImportError("torch.utils.ffi is deprecated. Please use cpp extensions instead.") ImportError: torch.utils.ffi is deprecated. Please use cpp extensions instead.

This seems to be deprecated for pytorch versions > 0.4 but on the repo, it is stated to use 1.1. Strangely I tried downgrading to torch==0.4.1 but the same error persists. Any ideas on how to work around that would be appreciated!

yrcong commented 2 years ago

Could you please tell me which GPU and CUDA version you are using?

RRuschel commented 2 years ago

I am using a couple of Titans Xp. But I fixed it, I was mistakenly compiling the faster RCNN code for older PyTorch instead of the newer branch that is for pytorch 1.