rotemtzaban / STIT

MIT License
1.2k stars 170 forks source link

help #11

Closed huanxve closed 2 years ago

huanxve commented 2 years ago

warnings.warn('Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:\n\n' + traceback.format_exc()) Setting up PyTorch plugin "upfirdn2d_plugin"... Failed! D:\dongzuoqianyi\STIT-main\torch_utils\ops\upfirdn2d.py:34: UserWarning: Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:

Traceback (most recent call last): File "D:\dongzuoqianyi\STIT-main\torch_utils\ops\upfirdn2d.py", line 32, in _init _plugin = custom_ops.get_plugin('upfirdn2d_plugin', sources=sources, extra_cuda_cflags=['--use_fast_math']) File "D:\dongzuoqianyi\STIT-main\torch_utils\custom_ops.py", line 110, in get_plugin torch.utils.cpp_extension.load(name=module_name, verbose=verbose_build, sources=sources, **build_kwargs) File "C:\ProgramData\Anaconda3\envs\stit\lib\site-packages\torch\utils\cpp_extension.py", line 1136, in load keep_intermediates=keep_intermediates) File "C:\ProgramData\Anaconda3\envs\stit\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 "C:\ProgramData\Anaconda3\envs\stit\lib\site-packages\torch\utils\cpp_extension.py", line 1752, in _import_module_from_library module = importlib.util.module_from_spec(spec) File "", line 583, in module_from_spec File "", line 1043, in create_module File "", line 219, in _call_with_frames_removed ImportError: DLL load failed: 找不到指定的模块。

warnings.warn('Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:\n\n' + traceback.format_exc()) Setting up PyTorch plugin "upfirdn2d_plugin"...

rotemtzaban commented 2 years ago

@huanxve I haven't tried the code on windows myself, but I think it should work, with some dependencies installed.

Make sure that you have all the requirements listed here: https://github.com/NVlabs/stylegan2-ada-pytorch#requirements Especially note the CUDA version installed, and Visual Studio.

Make sure that nvcc --version gives a version higher than 11.0

Infinitay commented 2 years ago

I've had a few issues with this myself, and as a preface I don't use Anaconda and I was running this locally on my machine (3080 10GB) in case it matters.

After confirming I followed all the steps properly to installing PyTorch and CUDA respectively, what I did first was install the package ninja as per suggestions. Afterwards I reinstalled PyTorch in just in case. This then resulted in another error for me regarding a missing Python39.lib. I took it from my Python lib folder within its installation directory and copied it over to my cuda folder. More specifically I placed it into C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\lib\x64.

That solved any issues with PyTorch and upfirdn2d_plugin. However I did start facing another issue with it crashing mid run. I was forced to set my environment variable to CUDA_LAUNCH_BLOCKING=1 in order to prevent it from crashing. So you can try that if you face the same issue. Unfortunately, it will increase the time it takes for each iteration. What was estimated to be originally a little over one hour took 4 hours.