GoGoDuck912 / Self-Correction-Human-Parsing

An out-of-box human parsing representation extractor.
MIT License
1.05k stars 236 forks source link

Testing on CPU #76

Closed vinodbukya6 closed 1 year ago

vinodbukya6 commented 2 years ago

Hi, Thank you so much for your work. I am running simple_extractor.py file to create Human Parser, but not working on CPU. Facing below error. Can anyone please help on how to resolve the issue.

Is simple_extractor.py runs only on GPU or compatible with CPU also?

ImportError: /home/vin/.cache/torch_extensions/py36_cu102/inplace_abn/inplace_abn.so: undefined symbol: _Z26leaky_relu_backward_cuda_hN2at6TensorES0_f

Mohamedballouch commented 2 years ago

hey Is there any updates regarding this one ?? did you solve it ?

vinodbukya6 commented 2 years ago

Yes, I have solved the issue.

asafjo23 commented 1 year ago

You managed to run it on CPU? or this model runs on GPU only?

vinodbukya6 commented 1 year ago

Hi @asafjo23 This model runs on CPU too, I have managed to run on CPU machine.

asafjo23 commented 1 year ago

Thanks for quick response! Can you please provide an example? I tried to run their script with no success. It always tries to load CUDA: image

hakob91 commented 1 year ago

Thanks for quick response! Can you please provide an example? I tried to run their script with no success. It always tries to load CUDA:

I am trying to run on the CPU too. I fixed that part by passing extra flags to the load function in modules/functions.py. cc: @asafjo23

Screenshot 2022-11-20 at 13 07 30

Now I stuck on other error.

In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/sstream:184:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/istream:163:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/ostream:137:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/bitset:116:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__bit_reference:15:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/cuda_wrappers/algorithm:79:25: error: unknown type name '__host__'
inline _CPP14_CONSTEXPR __host__ __device__ const __T &
                        ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/cuda_wrappers/algorithm:79:44: error: expected ';' at end of declaration
inline _CPP14_CONSTEXPR __host__ __device__ const __T &
                                           ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/cuda_wrappers/algorithm:79:51: error: unknown type name '__T'
inline _CPP14_CONSTEXPR __host__ __device__ const __T &
                                                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/cuda_wrappers/algorithm:80:11: error: unknown type name '__T'
max(const __T &__a, const __T &__b, __Cmp __cmp) {
          ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/cuda_wrappers/algorithm:80:27: error: unknown type name '__T'
max(const __T &__a, const __T &__b, __Cmp __cmp) {
                          ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/cuda_wrappers/algorithm:80:37: error: unknown type name '__Cmp'
max(const __T &__a, const __T &__b, __Cmp __cmp) {
                                    ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/cuda_wrappers/algorithm:86:25: error: unknown type name '__host__'
inline _CPP14_CONSTEXPR __host__ __device__ const __T &
                        ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/cuda_wrappers/algorithm:86:44: error: expected ';' at end of declaration
inline _CPP14_CONSTEXPR __host__ __device__ const __T &
                                           ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/cuda_wrappers/algorithm:86:51: error: unknown type name '__T'
inline _CPP14_CONSTEXPR __host__ __device__ const __T &
                                                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/cuda_wrappers/algorithm:87:11: error: unknown type name '__T'
max(const __T &__a, const __T &__b) {
          ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/cuda_wrappers/algorithm:87:27: error: unknown type name '__T'
max(const __T &__a, const __T &__b) {
                          ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/cuda_wrappers/algorithm:93:25: error: unknown type name '__host__'
inline _CPP14_CONSTEXPR __host__ __device__ const __T &
                        ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/cuda_wrappers/algorithm:93:44: error: expected ';' at end of declaration
inline _CPP14_CONSTEXPR __host__ __device__ const __T &
                                           ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/cuda_wrappers/algorithm:93:51: error: unknown type name '__T'
inline _CPP14_CONSTEXPR __host__ __device__ const __T &
                                                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/cuda_wrappers/algorithm:94:11: error: unknown type name '__T'
min(const __T &__a, const __T &__b, __Cmp __cmp) {
          ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/cuda_wrappers/algorithm:94:27: error: unknown type name '__T'
min(const __T &__a, const __T &__b, __Cmp __cmp) {
                          ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/cuda_wrappers/algorithm:94:37: error: unknown type name '__Cmp'
min(const __T &__a, const __T &__b, __Cmp __cmp) {
                                    ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/cuda_wrappers/algorithm:100:25: error: unknown type name '__host__'
inline _CPP14_CONSTEXPR __host__ __device__ const __T &
                        ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/cuda_wrappers/algorithm:100:44: error: expected ';' at end of declaration
inline _CPP14_CONSTEXPR __host__ __device__ const __T &
                                           ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated when compiling for sm_35.
ninja: build stopped: subcommand failed.
asafjo23 commented 1 year ago

@hakob91 Thanks for replying. This wouldn't solve the issue since the code is full with CUDA logic. Therefore, I don't think that only changing small part of the loading procedure will be enough. I guess @vinodbukya6 re-wrote the script to be able to run on CPU.

asafjo23 commented 1 year ago

OK, So after I changed the load function to be: image I am facing the same issue as @vinodbukya6 original issue. symbol not found in flat namespace (__Z12forward_cudaN2at6TensorES0_S0_S0_S0_bf) @vinodbukya6 how did you solved it?

vinodbukya6 commented 1 year ago

Hi @asafjo23 Let me check.

vinodbukya6 commented 1 year ago

Hi @asafjo23 and @hakob91 You can check CPU based Human Parser here: https://github.com/vinodbukya6/Self-Correction-Human-Parsing-CPU Human Parser Method used in some other Use Case, so added only Human Parsing related source files. Let me know if you face any issues.

asafjo23 commented 1 year ago

Wow @vinodbukya6 This is just great! Thanks a lot for you help :-)

hakob91 commented 1 year ago

@vinodbukya6 Thank you.