Skip to content

support for pytorch 1.5.0#592

Open
RodrigoGantier wants to merge 11 commits into
MVIG-SJTU:masterfrom
RodrigoGantier:master
Open

support for pytorch 1.5.0#592
RodrigoGantier wants to merge 11 commits into
MVIG-SJTU:masterfrom
RodrigoGantier:master

Conversation

@RodrigoGantier
Copy link
Copy Markdown

No description provided.

@yptheangel
Copy link
Copy Markdown

working well on my ubuntu 18 with cuda10.2, cudnn8, torch 1.5 torchvision 0.6
additional steps before running ./inference.sh is
sudo apt-get install gfortran and change the type of variables in vis.py

@angmc
Copy link
Copy Markdown

angmc commented Oct 1, 2020

@Fang-Haoshu I believe I managed to find the issue and got the setup running. I believe the way the c++ code was checking if it is a cuda tensor is no longer compatible with new versions of pytorch.

What I did to correct the issue is find occurrences of AT_CHECK in the c++ code and changed it to TORCH_CHECK. I had to change the following files: nms_cuda.cpp, roi_align_cuda.cpp, deform_cov_cuda.cpp, and deform_pool_cuda.cpp.

for example in the nms_cuda.cpp file the only change was

#define CHECK_CUDA(x) AT_CHECK(x.type().is_cuda(), #x, " must be a CUDAtensor ")
to
#define CHECK_CUDA(x) TORCH_CHECK(x.type().is_cuda(), #x, " must be a CUDAtensor ")

After making that change the setup ran correctly. Best of luck.

@bobby20180331
Copy link
Copy Markdown

For alpha pose(0.3.0),which based on torch 1.7 or above, does torch version matters?

@nikhilweee
Copy link
Copy Markdown

nikhilweee commented Feb 2, 2021

I tried merging this PR as per the instructions given in the installation instructions. However, I get the following error when I try running the inference script python scripts/demo_inference.py. I'm using pytorch 1.7.1 with torchvision 0.8.2.

Traceback (most recent call last):
  File "scripts/demo_inference.py", line 14, in <module>
    from trackers.tracker_api import Tracker
  File "/home/me/projects/alphapose/trackers/tracker_api.py", line 21, in <module>
    from utils.utils import *
  File "/home/me/projects/alphapose/trackers/utils/utils.py", line 16, in <module>
    from torchvision.ops import nms
ModuleNotFoundError: No module named 'torchvision.ops'

EDIT: I solved it by reinstalling torchvision conda install torchvision=0.8.2 -c pytorch.

@mgholamikn
Copy link
Copy Markdown

mgholamikn commented Feb 11, 2021

Thanks!! Worked for me.

@Fang-Haoshu I believe I managed to find the issue and got the setup running. I believe the way the c++ code was checking if it is a cuda tensor is no longer compatible with new versions of pytorch.

What I did to correct the issue is find occurrences of AT_CHECK in the c++ code and changed it to TORCH_CHECK. I had to change the following files: nms_cuda.cpp, roi_align_cuda.cpp, deform_cov_cuda.cpp, and deform_pool_cuda.cpp.

for example in the nms_cuda.cpp file the only change was

#define CHECK_CUDA(x) AT_CHECK(x.type().is_cuda(), #x, " must be a CUDAtensor ")
to
#define CHECK_CUDA(x) TORCH_CHECK(x.type().is_cuda(), #x, " must be a CUDAtensor ")

After making that change the setup ran correctly. Best of luck.

@mimocha
Copy link
Copy Markdown

mimocha commented Mar 15, 2021

@Fang-Haoshu I believe I managed to find the issue and got the setup running. I believe the way the c++ code was checking if it is a cuda tensor is no longer compatible with new versions of pytorch.

What I did to correct the issue is find occurrences of AT_CHECK in the c++ code and changed it to TORCH_CHECK. I had to change the following files: nms_cuda.cpp, roi_align_cuda.cpp, deform_cov_cuda.cpp, and deform_pool_cuda.cpp.

for example in the nms_cuda.cpp file the only change was

#define CHECK_CUDA(x) AT_CHECK(x.type().is_cuda(), #x, " must be a CUDAtensor ")
to
#define CHECK_CUDA(x) TORCH_CHECK(x.type().is_cuda(), #x, " must be a CUDAtensor ")

After making that change the setup ran correctly. Best of luck.

Thanks @angmc, I verified this fix to work for me as well.
For other people facing similar problems, the 4 files for changing AT_CHECK to TORCH_CHECK are in the following paths inside the AlphaPose directory:

alphapose/utils/roi_align/src/roi_align_cuda.cpp
alphapose/models/layers/dcn/src/deform_conv_cuda.cpp
alphapose/models/layers/dcn/src/deform_pool_cuda.cpp
detector/nms/src/nms_cuda.cpp

@Fang-Haoshu
Copy link
Copy Markdown
Member

Thanks, this PR has been merged to branch "pytorch<1.11"

@RichardKlem
Copy link
Copy Markdown

Thanks, this PR has been merged to branch "pytorch<1.11"
Is it possible then to close this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants