Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for pytorch 1.5.0 #592

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

RodrigoGantier
Copy link

No description provided.

@yptheangel
Copy link

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

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

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

@nikhilweee
Copy link

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

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

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
Member

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

@RichardKlem
Copy link

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.

None yet

9 participants