Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: DLL load failed while importing bias_act_plugin #88

Open
ziyuwzf opened this issue Dec 15, 2021 · 11 comments
Open

ImportError: DLL load failed while importing bias_act_plugin #88

ziyuwzf opened this issue Dec 15, 2021 · 11 comments

Comments

@ziyuwzf
Copy link

ziyuwzf commented Dec 15, 2021

Describe the bug
ImportError: DLL load failed while importing bias_act_plugin: 找不到指定的模块。

To Reproduce
Steps to reproduce the behavior:

  1. 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']"
  2. 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

@WeiDuan123
Copy link

Have you solved the problem? I have met the same question.

@bmquynhlinh
Copy link

I met this problem and was able to solve it:

  1. Check whether you install ninja or not
  2. I read the error logs and found out that ninja tries to load my CUDA 10.0 instead of the 11.2 version. So, I uninstall CUDA 10.0 and then bias_act_plugin loaded successfully

@gengzheliu
Copy link

i have exactly the same problems with you. i treid uninstall CUDA11.3 and pytorch1.10.2, but still doesn't work. is that problem with the verison?

@gengzheliu
Copy link

  • Check whether you install ninja or not
  • I read the error logs and found out that ninja tries to load my CUDA 10.0 instead of the 11.2 version. So, I uninstall CUDA 10.0 and then bias_act_plugin loaded successfully

Hi is that mean you installed 2 verison of CUDA and then you uninstalled one of them?

@bmquynhlinh
Copy link

Yes, I uninstalled it because I don't need it anymore. But, if you can keep multiple CUDA versions, and assign 11.2 to CUDA_HOME in env. It still works

@ziyuwzf
Copy link
Author

ziyuwzf commented Feb 22, 2022

I met this problem and was able to solve it:

  1. Check whether you install ninja or not
  2. I read the error logs and found out that ninja tries to load my CUDA 10.0 instead of the 11.2 version. So, I uninstall CUDA 10.0 and then bias_act_plugin loaded successfully

before CUDA11.4,i installed CUDA10,x,but i have assigned CUDA11.4 to CUDA_HOME in env,and no 10.x in env path.i will try you advisement,thanks

@49xxy
Copy link

49xxy commented Mar 23, 2022

I have the same problem. Have you solved it?Looking forward to your reply!

@jannehellsten
Copy link
Contributor

I recently found that VS2019 community edition doesn't work with StyleGAN3 but VS2022 does. Alas, using VS2022 required some small changes. In case anyone above is struggling, this change might help:

69c7ef0

@joinforcookies
Copy link

I had CUDA 12.1. I uninstalled it and installed CUDA 11.8 from https://developer.nvidia.com/cuda-11-8-0-download-archive?target_os=Windows&target_arch=x86_64&target_version=11&target_type=exe_local. How did I know? It was based on the available CUDA versions available in this PyTorch website https://pytorch.org/get-started/locally/ and it solved the issue.

@toprakfirat
Copy link

I had CUDA 12.1. I uninstalled it and installed CUDA 11.8 from https://developer.nvidia.com/cuda-11-8-0-download-archive?target_os=Windows&target_arch=x86_64&target_version=11&target_type=exe_local. How did I know? It was based on the available CUDA versions available in this PyTorch website https://pytorch.org/get-started/locally/ and it solved the issue.

I had the same issue, this worked for me.

@syf2012
Copy link

syf2012 commented Nov 19, 2023

I had CUDA 12.1. I uninstalled it and installed CUDA 11.8 from https://developer.nvidia.com/cuda-11-8-0-download-archive?target_os=Windows&target_arch=x86_64&target_version=11&target_type=exe_local. How did I know? It was based on the available CUDA versions available in this PyTorch website https://pytorch.org/get-started/locally/ and it solved the issue.

May I ask what version of torch you are using? I also installed cuda11.8, but it still does not work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants