ZPdesu / Barbershop

Barbershop: GAN-based Image Compositing using Segmentation Masks (SIGGRAPH Asia 2021)
https://zpdesu.github.io/Barbershop/
MIT License
1.35k stars 265 forks source link

ImportError: No module named 'fused' #12

Open yytbupt opened 2 years ago

yytbupt commented 2 years ago

when i run the command: python main.py --im_path1 90.png --im_path2 15.png --im_path3 117.png --sign realistic --smooth 5

i meet the following problem:

Traceback (most recent call last): File "main.py", line 13, in from models.Embedding import Embedding File "/home/yaoyuntao/programs/Barbershop-main/models/Embedding.py", line 3, in from models.Net import Net File "/home/yaoyuntao/programs/Barbershop-main/models/Net.py", line 3, in from models.stylegan2.model import Generator File "/home/yaoyuntao/programs/Barbershop-main/models/stylegan2/model.py", line 11, in from models.stylegan2.op import FusedLeakyReLU, fused_leaky_relu, upfirdn2d File "/home/yaoyuntao/programs/Barbershop-main/models/stylegan2/op/init.py", line 1, in from .fused_act import FusedLeakyReLU, fused_leaky_relu File "/home/yaoyuntao/programs/Barbershop-main/models/stylegan2/op/fused_act.py", line 14, in os.path.join(module_path, "fused_bias_act_kernel.cu"), File "/home/yaoyuntao/anaconda3/envs/Barbershop/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 997, in load keep_intermediates=keep_intermediates) File "/home/yaoyuntao/anaconda3/envs/Barbershop/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1213, in _jit_compile return _import_module_from_library(name, build_directory, is_python_module) File "/home/yaoyuntao/anaconda3/envs/Barbershop/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1560, in _import_module_from_library file, path, description = imp.find_module(module_name, [path]) File "/home/yaoyuntao/anaconda3/envs/Barbershop/lib/python3.7/imp.py", line 296, in find_module raise ImportError(_ERR_MSG.format(name), name=name) ImportError: No module named 'fused'

who can tell me the reason? thanks

ZPdesu commented 2 years ago

It’s an environment problem. Please set up a new conda environment based on the environment.yml file.

Praecordi commented 1 year ago

I'm having this problem, but on windows. I run the same above command, and received the error:

(barbershop) C:\Users\SS\Documents\Barbershop>python main.py --im_path1 90.png --im_path2 15.png --im_path3 117.png --sign realistic --smooth 5
Traceback (most recent call last):
  File "C:\Users\SS\Documents\Barbershop\main.py", line 13, in <module>
    from models.Embedding import Embedding
  File "C:\Users\SS\Documents\Barbershop\models\Embedding.py", line 3, in <module>
    from models.Net import Net
  File "C:\Users\SS\Documents\Barbershop\models\Net.py", line 3, in <module>
    from models.stylegan2.model import Generator
  File "C:\Users\SS\Documents\Barbershop\models\stylegan2\model.py", line 11, in <module>
    from models.stylegan2.op import FusedLeakyReLU, fused_leaky_relu, upfirdn2d
  File "C:\Users\SS\Documents\Barbershop\models\stylegan2\op\__init__.py", line 1, in <module>
    from .fused_act import FusedLeakyReLU, fused_leaky_relu
  File "C:\Users\SS\Documents\Barbershop\models\stylegan2\op\fused_act.py", line 10, in <module>
    fused = load(
  File "C:\Users\SS\AppData\Roaming\Python\Python310\site-packages\torch\utils\cpp_extension.py", line 1284, in load
    return _jit_compile(
  File "C:\Users\SS\AppData\Roaming\Python\Python310\site-packages\torch\utils\cpp_extension.py", line 1534, in _jit_compile
    return _import_module_from_library(name, build_directory, is_python_module)
  File "C:\Users\SS\AppData\Roaming\Python\Python310\site-packages\torch\utils\cpp_extension.py", line 1936, in _import_module_from_library
    module = importlib.util.module_from_spec(spec)
ImportError: DLL load failed while importing fused: The specified module could not be found.

I followed this in setting up my environment on windows. Can you give more details on what might be causing this problem?