DragGAN reports an error Setting up PyTorch plugin "bias_act_plugin"... Failed! and FAILED: bias_act.cuda.o solution

question

DragGAN is finally open source, so the download and installation result reported an error. After checking a lot of information, there was no solution, so I installed a ChatGLM2-6B, pasted my problem on it, and gave the solution, and the result was solved directly. Unresolved issue for a day.

The error reported after running is attached below:

File under cache_dir (./checkpoints):
['stylegan2_horses_256_pytorch.pkl', 'stylegan_human_v2_512.pkl', 'stylegan2_lions_512_pytorch.pkl', 'stylegan2-afhqcat-512x512.pkl', 'stylegan2-car-config-f.pkl', 'stylegan2_elephants_512_pytorch.pkl', 'stylegan2_dogs_1024_pytorch.pkl', 'stylegan2-lhq-256x256.pkl', 'stylegan2-cat-config-f.pkl', 'stylegan2-ffhq-512x512.pkl']
Valid checkpoint file:
{'stylegan2_horses_256_pytorch': './checkpoints/stylegan2_horses_256_pytorch.pkl', 'stylegan_human_v2_512': './checkpoints/stylegan_human_v2_512.pkl', 'stylegan2_lions_512_pytorch': './checkpoints/stylegan2_lions_512_pytorch.pkl', 'stylegan2-afhqcat-512x512': './checkpoints/stylegan2-afhqcat-512x512.pkl', 'stylegan2-car-config-f': './checkpoints/stylegan2-car-config-f.pkl', 'stylegan2_elephants_512_pytorch': './checkpoints/stylegan2_elephants_512_pytorch.pkl', 'stylegan2_dogs_1024_pytorch': './checkpoints/stylegan2_dogs_1024_pytorch.pkl', 'stylegan2-lhq-256x256': './checkpoints/stylegan2-lhq-256x256.pkl', 'stylegan2-cat-config-f': './checkpoints/stylegan2-cat-config-f.pkl', 'stylegan2-ffhq-512x512': './checkpoints/stylegan2-ffhq-512x512.pkl'}
Loading "./checkpoints/stylegan2_lions_512_pytorch.pkl"... Done.
()
{'z_dim': 512, 'c_dim': 0, 'w_dim': 512, 'img_resolution': 512, 'img_channels': 3, 'mapping_kwargs': {'num_layers': 8, 'embed_features': None, 'layer_features': None, 'activation': 'lrelu', 'lr_multiplier': 0.01, 'w_avg_beta': 0.995}, 'synthesis_kwargs': {'channel_base': 32768, 'channel_max': 512, 'num_fp16_res': 0, 'conv_clamp': None, 'architecture': 'skip', 'resample_filter': [1, 3, 3, 1], 'use_noise': True, 'activation': 'lrelu'}}
Setting up PyTorch plugin "bias_act_plugin"... Failed!
Traceback (most recent call last):
File "/data/DragGAN/venv/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1893, in _run_ninja_build
subprocess.run(
File "/home/sh/miniconda3/envs/webui/lib/python3.10/subprocess.py", line 526, in run
raise CalledProcessError(retcode, process.args,
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 "/data/DragGAN/drag.py", line 200, in
global_state = init_images(global_state)
File "/data/DragGAN/drag.py", line 70, in init_images
state['renderer'].init_network(
File "/data/DragGAN/viz/renderer.py", line 248, in init_network
w = G.mapping(z, label, truncation_psi=trunc_psi, truncation_cutoff=trunc_cutoff)
File "/data/DragGAN/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(args, kwargs)
File "/data/DragGAN/training/networks_stylegan2.py", line 247, in forward
x = layer(x)
File "/data/DragGAN/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(args, **kwargs)
File "/data/DragGAN/training/networks_stylegan2.py", line 125, in forward
x = bias_act.bias_act(x, b, act=self.activation)
File "/data/DragGAN/torch_utils/ops/bias_act.py", line 84, in bias_act
if impl == 'cuda' and x.device.type == 'cuda' and _init():
File "/data/DragGAN/torch_utils/ops/bias_act.py", line 41, in _init
_plugin = custom_ops.get_plugin(
File "/data/DragGAN/torch_utils/custom_ops.py", line 136, in get_plugin
torch.utils.cpp_extension.load(name=module_name, build_directory=cached_build_dir,
File "/data/DragGAN/venv/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1284, in load
return _jit_compile(
File "/data/DragGAN/venv/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1509, in _jit_compile
_write_ninja_file_and_build_library(
File "/data/DragGAN/venv/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1624, in _write_ninja_file_and_build_library
_run_ninja_build(
File "/data/DragGAN/venv/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1909, in _run_ninja_build
raise RuntimeError(message) from e
RuntimeError: Error building extension 'bias_act_plugin': [1/2] /usr/local/cuda/bin/nvcc -DTORCH_EXTENSION_NAME=bias_act_plugin -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -isystem /data/DragGAN/venv/lib/python3.10/site-packages/torch/include -isystem /data/DragGAN/venv/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -isystem /data/DragGAN/venv/lib/python3.10/site-packages/torch/include/TH -isystem /data/DragGAN/venv/lib/python3.10/site-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /home/sh/miniconda3/envs/webui/include/python3.10 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_89,code=compute_89 -gencode=arch=compute_89,code=sm_89 --compiler-options '-fPIC' --use_fast_math --allow-unsupported-compiler -std=c++17 -c /home/sh/.cache/torch_extensions/py310_cu118/bias_act_plugin/3cb576a0039689487cfba59279dd6d46-nvidia-geforce-rtx-4090/bias_act.cu -o bias_act.cuda.o
FAILED: bias_act.cuda.o
/usr/local/cuda/bin/nvcc -DTORCH_EXTENSION_NAME=bias_act_plugin -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -isystem /data/DragGAN/venv/lib/python3.10/site-packages/torch/include -isystem /data/DragGAN/venv/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -isystem /data/DragGAN/venv/lib/python3.10/site-packages/torch/include/TH -isystem /data/DragGAN/venv/lib/python3.10/site-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /home/sh/miniconda3/envs/webui/include/python3.10 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_89,code=compute_89 -gencode=arch=compute_89,code=sm_89 --compiler-options '-fPIC' --use_fast_math --allow-unsupported-compiler -std=c++17 -c /home/sh/.cache/torch_extensions/py310_cu118/bias_act_plugin/3cb576a0039689487cfba59279dd6d46-nvidia-geforce-rtx-4090/bias_act.cu -o bias_act.cuda.o
nvcc fatal : Unsupported gpu architecture 'compute_89'
ninja: build stopped: subcommand failed.

I input the output information in ChatGLM2-6B, and then ask ChatGLM2-6B to give a specific solution.

 I directly installed it using pip install nvcc ninja according to the command it gave, and then ran DragGAN, and it turned out to be able to run. It was a bit unnecessary to make a lot of them before.

Here is the display interface:

 

If you have any questions, you can follow the official account to add authors, enter the technology exchange group, learn together, and work hard together!

Guess you like

Origin blog.csdn.net/weixin_41529012/article/details/131431665