HRNet / HRNet-Semantic-Segmentation

The OCR approach is rephrased as Segmentation Transformer: https://arxiv.org/abs/1909.11065. This is an official implementation of semantic segmentation for HRNet. https://arxiv.org/abs/1908.07919
Other
3.09k stars 683 forks source link

How to deal with error : subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1. #210

Open zjbit opened 3 years ago

zjbit commented 3 years ago

python tools/train.py --cfg experiments/cityscapes/seg_hrnet_w48_train_512x1024_sgd_lr1e-2_wd5e-4_bs_12_epoch484.yaml
Traceback (most recent call last): File "/home/anaconda3/envs/develop/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 949, in _build_extension_module check=True) File "/home/anaconda3/envs/develop/lib/python3.6/subprocess.py", line 418, in run output=stdout, stderr=stderr) subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "tools/train.py", line 27, in import models File "/home/workspace/python/HRNet-Semantic-Segmentation/tools/../lib/models/init.py", line 11, in import models.seg_hrnet File "/home/workspace/python/HRNet-Semantic-Segmentation/tools/../lib/models/seg_hrnet.py", line 22, in from .sync_bn.inplace_abn.bn import InPlaceABNSync File "/home/workspace/python/HRNet-Semantic-Segmentation/tools/../lib/models/sync_bn/init.py", line 1, in from .inplace_abn import bn File "/home/workspace/python/HRNet-Semantic-Segmentation/tools/../lib/models/sync_bn/inplace_abn/init.py", line 1, in from .bn import ABN, InPlaceABN, InPlaceABNSync File "/home/workspace/python/HRNet-Semantic-Segmentation/tools/../lib/models/sync_bn/inplace_abn/bn.py", line 14, in from functions import * File "/home/workspace/python/HRNet-Semantic-Segmentation/lib/models/sync_bn/inplace_abn/functions.py", line 16, in extra_cuda_cflags=["--expt-extended-lambda"]) File "/home/anaconda3/envs/develop/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 644, in load is_python_module) File "/home/anaconda3/envs/develop/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 813, in _jit_compile with_cuda=with_cuda) File "/home/anaconda3/envs/develop/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 866, in _write_ninja_file_and_build _build_extension_module(name, build_directory, verbose) File "/home/anaconda3/envs/develop/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 962, in _build_extension_module raise RuntimeError(message) RuntimeError: Error building extension 'inplace_abn': b'[1/3] c++ -MMD -MF inplace_abn_cpu.o.d -DTORCH_EXTENSION_NAME=inplace_abn -DTORCH_API_INCLUDE_EXTENSION_H -isystem /home/anaconda3/envs/develop/lib/python3.6/site-packages/torch/include -isystem /home/anaconda3/envs/develop/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -isystem /home/anaconda3/envs/develop/lib/python3.6/site-packages/torch/include/TH -isystem /home/anaconda3/envs/develop/lib/python3.6/site-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /home/anaconda3/envs/develop/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++11 -O3 -c /home/workspace/python/HRNet-Semantic-Segmentation/lib/models/sync_bn/inplace_abn/src/inplace_abn_cpu.cpp -o inplace_abn_cpu.o\nFAILED: inplace_abn_cpu.o \nc++ -MMD -MF inplace_abn_cpu.o.d -DTORCH_EXTENSION_NAME=inplace_abn -DTORCH_API_INCLUDE_EXTENSION_H -isystem /home/anaconda3/envs/develop/lib/python3.6/site-packages/torch/include -isystem /home/anaconda3/envs/develop/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -isystem /home/anaconda3/envs/develop/lib/python3.6/site-packages/torch/include/TH -isystem /home/anaconda3/envs/develop/lib/python3.6/site-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /home/anaconda3/envs/develop/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++11 -O3 -c /home/workspace/python/HRNet-Semantic-Segmentation/lib/models/sync_bn/inplace_abn/src/inplace_abn_cpu.cpp -o inplace_abn_cpu.o\n/home/workspace/python/HRNet-Semantic-Segmentation/lib/models/sync_bn/inplace_abn/src/inplace_abn_cpu.cpp: In function \'std::vector backward_cpu(at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, bool, float)\':\n/home/workspace/python/HRNet-Semantic-Segmentation/lib/models/sync_bn/inplace_abn/src/inplace_abn_cpu.cpp:82:34: error: could not convert \'z.at::Tensor::type()\' from \'at::DeprecatedTypeProperties\' to \'c10::IntArrayRef {aka c10::ArrayRef}\'\n auto dweight = at::empty(z.type(), {0});\n ~~^~\n/home/workspace/python/HRNet-Semantic-Segmentation/lib/models/sync_bn/inplace_abn/src/inplace_abn_cpu.cpp:83:32: error: could not convert \'z.at::Tensor::type()\' from \'at::DeprecatedTypeProperties\' to \'c10::IntArrayRef {aka c10::ArrayRef}\'\n auto dbias = at::empty(z.type(), {0});\n ~~^~\n/home/workspace/python/HRNet-Semantic-Segmentation/lib/models/sync_bn/inplace_abn/src/inplace_abn_cpu.cpp:89:29: error: could not convert \'{dx, dweight, dbias}\' from \'\' to \'std::vector\'\n return {dx, dweight, dbias};\n ^\n[2/3] /usr/local/cuda/bin/nvcc -DTORCH_EXTENSION_NAME=inplace_abn -DTORCH_API_INCLUDE_EXTENSION_H -isystem /home/anaconda3/envs/develop/lib/python3.6/site-packages/torch/include -isystem /home/anaconda3/envs/develop/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -isystem /home/anaconda3/envs/develop/lib/python3.6/site-packages/torch/include/TH -isystem /home/anaconda3/envs/develop/lib/python3.6/site-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /home/anaconda3/envs/develop/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS__ --compiler-options \'-fPIC\' --expt-extended-lambda -std=c++11 -c /home/workspace/python/HRNet-Semantic-Segmentation/lib/models/sync_bn/inplace_abn/src/inplace_abn_cuda.cu -o inplace_abn_cuda.cuda.o\nFAILED: inplace_abn_cuda.cuda.o \n/usr/local/cuda/bin/nvcc -DTORCH_EXTENSION_NAME=inplace_abn -DTORCH_API_INCLUDE_EXTENSION_H -isystem /home/anaconda3/envs/develop/lib/python3.6/site-packages/torch/include -isystem /home/anaconda3/envs/develop/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -isystem /home/anaconda3/envs/develop/lib/python3.6/site-packages/torch/include/TH -isystem /home/anaconda3/envs/develop/lib/python3.6/site-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /home/anaconda3/envs/develop/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS__ --compiler-options \'-fPIC\' --expt-extended-lambda -std=c++11 -c /home/workspace/python/HRNet-Semantic-Segmentation/lib/models/sync_bn/inplace_abn/src/inplace_abn_cuda.cu -o inplace_abn_cuda.cuda.o\n/home/workspace/python/HRNet-Semantic-Segmentation/lib/models/sync_bn/inplace_abn/src/inplace_abn_cuda.cu(99): error: no suitable user-defined conversion from "at::DeprecatedTypeProperties" to "c10::IntArrayRef" exists\n\n/home/workspace/python/HRNet-Semantic-Segmentation/lib/models/sync_bn/inplace_abn/src/inplace_abn_cuda.cu(99): error: no instance of constructor "c10::TensorOptions::TensorOptions" matches the argument list\n argument types are: (int64_t)\n\n/home/workspace/python/HRNet-Semantic-Segmentation/lib/models/sync_bn/inplace_abn/src/inplace_abn_cuda.cu(100): error: no suitable user-defined conversion from "at::DeprecatedTypeProperties" to "c10::IntArrayRef" exists\n\n/home/workspace/python/HRNet-Semantic-Segmentation/lib/models/sync_bn/inplace_abn/src/inplace_abn_cuda.cu(100): error: no instance of constructor "c10::TensorOptions::TensorOptions" matches the argument list\n argument types are: (int64_t)\n\n/home/workspace/python/HRNet-Semantic-Segmentation/lib/models/sync_bn/inplace_abn/src/inplace_abn_cuda.cu(202): error: no suitable user-defined conversion from "at::DeprecatedTypeProperties" to "c10::IntArrayRef" exists\n\n/home/workspace/python/HRNet-Semantic-Segmentation/lib/models/sync_bn/inplace_abn/src/inplace_abn_cuda.cu(202): error: no instance of constructor "c10::TensorOptions::TensorOptions" matches the argument list\n argument types are: (int64_t)\n\n/home/workspace/python/HRNet-Semantic-Segmentation/lib/models/sync_bn/inplace_abn/src/inplace_abn_cuda.cu(203): error: no suitable user-defined conversion from "at::DeprecatedTypeProperties" to "c10::IntArrayRef" exists\n\n/home/workspace/python/HRNet-Semantic-Segmentation/lib/models/sync_bn/inplace_abn/src/inplace_abn_cuda.cu(203): error: no instance of constructor "c10::TensorOptions::TensorOptions" matches the argument list\n argument types are: (int64_t)\n\n8 errors detected in the compilation of "/tmp/tmpxft_00000952_00000000-6_inplace_abn_cuda.cpp1.ii".\nninja: build stopped: subcommand failed.\n'

Kent0n-Li commented 3 years ago

change the torch version to 0.4.1