yuval-alaluf / stylegan3-editing

Official Implementation of "Third Time's the Charm? Image and Video Editing with StyleGAN3" (AIM ECCVW 2022) https://arxiv.org/abs/2201.13433
https://yuval-alaluf.github.io/stylegan3-editing/
MIT License
660 stars 72 forks source link

issues with ninja, inference_editing no working #43

Closed gozi1123 closed 2 years ago

gozi1123 commented 2 years ago

I created a new conda env using the requirements file. Then tried to run inference_editing.py, and got the error: ninja: build stopped: subcommand failed.

What am I doing wrong? Ubuntu 18.04, gpu T4

Full log: Traceback (most recent call last): File "/home/galgozes/anaconda3/envs/sg3_env/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 1723, in _run_ninja_build env=env) File "/home/galgozes/anaconda3/envs/sg3_env/lib/python3.6/subprocess.py", line 418, in run output=stdout, stderr=stderr) subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "inversion/scripts/inference_editing.py", line 21, in from utils.inference_utils import get_average_image, run_on_batch, load_encoder File "./utils/inference_utils.py", line 9, in from inversion.models.e4e3 import e4e File "./inversion/models/e4e3.py", line 5, in from inversion.models.encoders import restyle_e4e_encoders File "./inversion/models/encoders/restyle_e4e_encoders.py", line 8, in from inversion.models.encoders.map2style import GradualStyleBlock File "./inversion/models/encoders/map2style.py", line 5, in from models.stylegan2.model import EqualLinear File "./models/stylegan2/model.py", line 8, in from models.stylegan2.op import FusedLeakyReLU, fused_leaky_relu, upfirdn2d File "./models/stylegan2/op/init.py", line 1, in from .fused_act import FusedLeakyReLU, fused_leaky_relu File "./models/stylegan2/op/fused_act.py", line 13, in os.path.join(module_path, 'fused_bias_act_kernel.cu'), File "/home/galgozes/anaconda3/envs/sg3_env/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 1136, in load keep_intermediates=keep_intermediates) File "/home/galgozes/anaconda3/envs/sg3_env/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 1347, in _jit_compile is_standalone=is_standalone) File "/home/galgozes/anaconda3/envs/sg3_env/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 1452, in _write_ninja_file_and_build_library error_prefix=f"Error building extension '{name}'") File "/home/galgozes/anaconda3/envs/sg3_env/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 1733, in _run_ninja_build raise RuntimeError(message) from e RuntimeError: Error building extension 'fused': [1/2] /usr/bin/nvcc -DTORCH_EXTENSION_NAME=fused -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -isystem /home/galgozes/anaconda3/envs/sg3_env/lib/python3.6/site-packages/torch/include -isystem /home/galgozes/anaconda3/envs/sg3_env/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -isystem /home/galgozes/anaconda3/envs/sg3_env/lib/python3.6/site-packages/torch/include/TH -isystem /home/galgozes/anaconda3/envs/sg3_env/lib/python3.6/site-packages/torch/include/THC -isystem /home/galgozes/anaconda3/envs/sg3_env/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr -gencode=arch=compute_70,code=compute_70 -gencode=arch=compute_70,code=sm_70 --compiler-options '-fPIC' -std=c++14 -c /home/galgozes/stylegan3-editing/models/stylegan2/op/fused_bias_act_kernel.cu -o fused_bias_act_kernel.cuda.o FAILED: fused_bias_act_kernel.cuda.o /usr/bin/nvcc -DTORCH_EXTENSION_NAME=fused -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -isystem /home/galgozes/anaconda3/envs/sg3_env/lib/python3.6/site-packages/torch/include -isystem /home/galgozes/anaconda3/envs/sg3_env/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -isystem /home/galgozes/anaconda3/envs/sg3_env/lib/python3.6/site-packages/torch/include/TH -isystem /home/galgozes/anaconda3/envs/sg3_env/lib/python3.6/site-packages/torch/include/THC -isystem /home/galgozes/anaconda3/envs/sg3_env/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr -gencode=arch=compute_70,code=compute_70 -gencode=arch=compute_70,code=sm_70 --compiler-options '-fPIC' -std=c++14 -c /home/galgozes/stylegan3-editing/models/stylegan2/op/fused_bias_act_kernel.cu -o fused_bias_act_kernel.cuda.o /usr/include/c++/6/tuple: In instantiation of ‘static constexpr bool std::_TC<, _Elements>::_MoveConstructibleTuple() [with _UElements = {std::tuple<at::Tensor, at::Tensor, at::Tensor>}; bool = true; _Elements = {at::Tensor, at::Tensor, at::Tensor}]’: /usr/include/c++/6/tuple:626:248: required by substitution of ‘template<class ... _UElements, typename std::enable_if<(((std::_TC<(sizeof... (_UElements) == 1), at::Tensor, at::Tensor, at::Tensor>::_NotSameTuple<_UElements ...>() && std::_TC<(1ul == sizeof... (_UElements)), at::Tensor, at::Tensor, at::Tensor>::_MoveConstructibleTuple<_UElements ...>()) && std::_TC<(1ul == sizeof... (_UElements)), at::Tensor, at::Tensor, at::Tensor>::_ImplicitlyMoveConvertibleTuple<_UElements ...>()) && (3ul >= 1)), bool>::type > constexpr std::tuple< >::tuple(_UElements&& ...) [with _UElements = {std::tuple<at::Tensor, at::Tensor, at::Tensor>}; typename std::enable_if<(((std::_TC<(sizeof... (_UElements) == 1), at::Tensor, at::Tensor, at::Tensor>::_NotSameTuple<_UElements ...>() && std::_TC<(1ul == sizeof... (_UElements)), at::Tensor, at::Tensor, at::Tensor>::_MoveConstructibleTuple<_UElements ...>()) && std::_TC<(1ul == sizeof... (_UElements)), at::Tensor, at::Tensor, at::Tensor>::_ImplicitlyMoveConvertibleTuple<_UElements ...>()) && (3ul >= 1)), bool>::type = ]’ /home/galgozes/anaconda3/envs/sg3_env/lib/python3.6/site-packages/torch/include/ATen/core/TensorBody.h:4525:74: required from here /usr/include/c++/6/tuple:483:67: error: mismatched argument pack lengths while expanding ‘std::is_constructible<_Elements, _UElements&&>’ return _and<is_constructible<_Elements, _UElements&&>...>::value; ^~~~~

and the log goes on and on, ends with: /usr/include/c++/6/type_traits:1558:8: note: provided for ‘template<class _From, class _To> struct std::is_convertible’ struct is_convertible ^~~~~~ ninja: build stopped: subcommand failed.

gozi1123 commented 2 years ago

Initiated a new GCP VM and it worked. Maybe issue with a local variable in previous vm? As long that it works