ImportError: DLL load failed while importing bias_act_plugin
Author: ziyuwzfCreated Dec 15, 2021Updated Jul 19, 2025
Describe the bug ImportError: DLL load failed while importing bias_act_plugin: 找不到指定的模块。
To Reproduce Steps to reproduce the behavior:
- In 'stylegan3-main' directory, run command 'python gen_images.py', and before it i set "F:\Python39\lib\site-packages\torch\\utils\cpp_extension.py" line 1682 code from "command = ['ninja', '-v']" to " command = ['ninja', '--version']"
- See error (copy&paste full log, including exceptions and stacktraces). F:\Python39\python.exe F:/PycharmProjects/stylegan3-main/gen_images.py --outdir=out --trunc=1 --seeds=2 --network=./files/stylegan3-r-afhqv2-512x512.pkl Loading networks from "./files/stylegan3-r-afhqv2-512x512.pkl"... Generating image for seed 2 (0/1) ... Setting up PyTorch plugin "bias_act_plugin"... Failed! Traceback (most recent call last): File "F:\PycharmProjects\stylegan3-main\gen_images.py", line 143, in generate_images() # pylint: disable=no-value-for-parameter File "F:\Python39\lib\site-packages\click\core.py", line 1128, in call return self.main(*args, **kwargs) File "F:\Python39\lib\site-packages\click\core.py", line 1053, in main rv = self.invoke(ctx) File "F:\Python39\lib\site-packages\click\core.py", line 1395, in invoke return ctx.invoke(self.callback, **ctx.params) File "F:\Python39\lib\site-packages\click\core.py", line 754, in invoke return __callback(*args, **kwargs) File "F:\PycharmProjects\stylegan3-main\gen_images.py", line 135, in generate_images img = G(z, label, truncation_psi=truncation_psi, noise_mode=noise_mode) File "F:\Python39\lib\site-packages\torch\nn\modules\module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "", line 503, in forward File "F:\Python39\lib\site-packages\torch\nn\modules\module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "", line 143, in forward File "F:\Python39\lib\site-packages\torch\nn\modules\module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "", line 92, in forward File "F:\PycharmProjects\stylegan3-main\torch_utils\ops\bias_act.py", line 84, in bias_act if impl == 'cuda' and x.device.type == 'cuda' and _init(): File "F:\PycharmProjects\stylegan3-main\torch_utils\ops\bias_act.py", line 41, in _init _plugin = custom_ops.get_plugin( File "F:\PycharmProjects\stylegan3-main\torch_utils\custom_ops.py", line 140, in get_plugin torch.utils.cpp_extension.load(name=module_name, build_directory=cached_build_dir, File "F:\Python39\lib\site-packages\torch\\utils\cpp_extension.py", line 1124, in load return _jit_compile( File "F:\Python39\lib\site-packages\torch\\utils\cpp_extension.py", line 1362, in _jit_compile return _import_module_from_library(name, build_directory, is_python_module) File "F:\Python39\lib\site-packages\torch\\utils\cpp_extension.py", line 1752, in _import_module_from_library module = importlib.util.module_from_spec(spec) File "(frozen importlib._bootstrap)", line 565, in module_from_spec File "(frozen importlib._bootstrap_external)", line 1173, in create_module File "(frozen importlib._bootstrap)", line 228, in _call_with_frames_removed ImportError: DLL load failed while importing bias_act_plugin: 找不到指定的模块。
Expected behavior A clear and concise description of what you expected to happen.
Desktop (please complete the following information):
- OS: [Windows 10]
- PyTorch version (pytorch 1.10.0+cu113)
- CUDA toolkit version (CUDA 11.4)
- NVIDIA driver version(471)
- GPU [RTX 1060]
i have tried remove C:\Users{username}\AppData\Local\torch_extensions\torch_extensions\Cache\bias_act_plugin,but it not works
Source: NVlabs/stylegan3