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: No module named 'upfirdn2d_plugin' #4

Open
maizer2 opened this issue Aug 24, 2022 · 3 comments
Open

ImportError: No module named 'upfirdn2d_plugin' #4

maizer2 opened this issue Aug 24, 2022 · 3 comments

Comments

@maizer2
Copy link

maizer2 commented Aug 24, 2022

Error message

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!
/workspace/PASTA-GAN-plusplus/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 "/workspace/PASTA-GAN-plusplus/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 "/workspace/PASTA-GAN-plusplus/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 "/opt/conda/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 986, in load
    return _jit_compile(
  File "/opt/conda/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1213, in _jit_compile
    return _import_module_from_library(name, build_directory, is_python_module)
  File "/opt/conda/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1560, in _import_module_from_library
    file, path, description = imp.find_module(module_name, [path])
  File "/opt/conda/lib/python3.8/imp.py", line 296, in find_module
    raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named 'upfirdn2d_plugin'

torch_utils/ops/upfirdn2d.py

line 31 ~ 35

try:
   _plugin = custom_ops.get_plugin('upfirdn2d_plugin', sources=sources, extra_cuda_cflags=['--use_fast_math'])
except:
   warnings.warn('Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:\n\n' + traceback.format_exc())

Reference

StyleGAN2 issue

@Cwj1212
Copy link

Cwj1212 commented Sep 12, 2022

I have the same problem, did you solve it?

@maizer2
Copy link
Author

maizer2 commented Sep 13, 2022

@Cwj1212 I think that problem is caused by the ninja module

i just annotate that module line

@Cwj1212
Copy link

Cwj1212 commented Sep 13, 2022

@Cwj1212 I think that problem is caused by the ninja module

i just annotate that module line

If it is directly annotated, it will not use custom operators for acceleration, and will not involve cpp extensions. It can be run directly but the efficiency will be reduced.

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

2 participants