DragGAN icon indicating copy to clipboard operation
DragGAN copied to clipboard

Windows

Open chazhenry opened this issue 1 year ago • 8 comments

I see a gui.bat file!

Is it possible to run on Windows10? I have a conda environment and the weights downloaded. It starts to run but errors as below. Tried it both a Cuda 12 GPU machine and also a CPU machine.

  File "C:\Users\ChalkTalk\Documents\DragGAN\viz\renderer.py", line 80, in __init__
    self._start_event   = torch.cuda.Event(enable_timing=True)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ChalkTalk\.conda\envs\draggan\Lib\site-packages\torch\cuda\streams.py", line 164, in __new__
    return super(Event, cls).__new__(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ChalkTalk\.conda\envs\draggan\Lib\site-packages\torch\cuda\_utils.py", line 46, in err_fn
    raise RuntimeError(
RuntimeError: Tried to instantiate dummy base class Event

chazhenry avatar Jun 28 '23 18:06 chazhenry

Comment all lines that have self._end_event or self._start_event In them, and add passes where needed in the viz/renderer.py file. These variables only deal with timing

the-jasoney avatar Jun 29 '23 00:06 the-jasoney

It is better to use a WSL instance though

the-jasoney avatar Jun 29 '23 00:06 the-jasoney

I see a gui.bat file!

Is it possible to run on Windows10? I have a conda environment and the weights downloaded. It starts to run but errors as below. Tried it both a Cuda 12 GPU machine and also a CPU machine.

  File "C:\Users\ChalkTalk\Documents\DragGAN\viz\renderer.py", line 80, in __init__
    self._start_event   = torch.cuda.Event(enable_timing=True)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ChalkTalk\.conda\envs\draggan\Lib\site-packages\torch\cuda\streams.py", line 164, in __new__
    return super(Event, cls).__new__(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ChalkTalk\.conda\envs\draggan\Lib\site-packages\torch\cuda\_utils.py", line 46, in err_fn
    raise RuntimeError(
RuntimeError: Tried to instantiate dummy base class Event

Try install torch from the follow link, pytorch and cuda must match the version. https://pytorch.org/get-started/locally/

The commands below works for me. pip uninstall torch torchvision torchaudio pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

zhangxl296 avatar Jun 29 '23 01:06 zhangxl296

Progress. Interface comes up and tries to load the lion checkpoints. Fails setting up 'bias_act_plugin'. I tried other pkl files (e.g. car). All throw the same error.

(draggan) X:\GAN\DragGAN>.\scripts\gui.bat
Loading "X:\GAN\DragGAN\checkpoints\stylegan2_lions_512_pytorch.pkl"... Done.
()
{'z_dim': 512, 'c_dim': 0, 'w_dim': 512, 'img_resolution': 512, 'img_channels': 3, 'mapping_kwargs': {'num_layers': 8, 'embed_features': None, 'layer_features': None, 'activation': 'lrelu', 'lr_multiplier': 0.01, 'w_avg_beta': 0.995}, 'synthesis_kwargs': {'channel_base': 32768, 'channel_max': 512, 'num_fp16_res': 0, 'conv_clamp': None, 'architecture': 'skip', 'resample_filter': [1, 3, 3, 1], 'use_noise': True, 'activation': 'lrelu'}}
Setting up PyTorch plugin "bias_act_plugin"... Failed!

Traceback (most recent call last):
  File "X:\GAN\DragGAN\viz\renderer.py", line 112, in render
    self.init_network(res, **args)
  File "X:\GAN\DragGAN\viz\renderer.py", line 249, in init_network
    w = G.mapping(z, label, truncation_psi=trunc_psi, truncation_cutoff=trunc_cutoff)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\chaz\.conda\envs\draggan\Lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "X:\GAN\DragGAN\training\networks_stylegan2.py", line 247, in forward
    x = layer(x)
        ^^^^^^^^
  File "C:\Users\chaz\.conda\envs\draggan\Lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "X:\GAN\DragGAN\training\networks_stylegan2.py", line 125, in forward
    x = bias_act.bias_act(x, b, act=self.activation)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "X:\GAN\DragGAN\torch_utils\ops\bias_act.py", line 84, in bias_act
    if impl == 'cuda' and x.device.type == 'cuda' and _init():
                                                      ^^^^^^^
  File "X:\GAN\DragGAN\torch_utils\ops\bias_act.py", line 41, in _init
    _plugin = custom_ops.get_plugin(
              ^^^^^^^^^^^^^^^^^^^^^^
  File "X:\GAN\DragGAN\torch_utils\custom_ops.py", line 136, in get_plugin
    torch.utils.cpp_extension.load(name=module_name, build_directory=cached_build_dir,
  File "C:\Users\chaz\.conda\envs\draggan\Lib\site-packages\torch\utils\cpp_extension.py", line 1284, in load
    return _jit_compile(
           ^^^^^^^^^^^^^
  File "C:\Users\chaz\.conda\envs\draggan\Lib\site-packages\torch\utils\cpp_extension.py", line 1535, in _jit_compile
    return _import_module_from_library(name, build_directory, is_python_module)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\chaz\.conda\envs\draggan\Lib\site-packages\torch\utils\cpp_extension.py", line 1929, in _import_module_from_library
    module = importlib.util.module_from_spec(spec)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 573, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 1233, in create_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
ImportError: DLL load failed while importing bias_act_plugin: The specified module could not be found.

chazhenry avatar Jun 29 '23 02:06 chazhenry

It is better to use a WSL instance though

Did you get to it work? I'm still trying in WSL2 and conda but there is one error before another

darthzulder avatar Jun 29 '23 19:06 darthzulder

same error happened on WSL2 Almost got stuck and stopped Setting up PyTorch plugin "bias_act_plugin"... Failed!

PeakGymnast avatar Jun 30 '23 03:06 PeakGymnast

same here

alinabel avatar Jun 30 '23 05:06 alinabel

i just got this to work on WSL2.

this helped https://github.com/openai/spinningup/issues/377#issue-1448866153

so ln -s -f /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.30 $CONDA_PREFIX/lib/libstdc++.so.6

also a weird thing with gui.sh, it doesn't like the backslashes/new lines?? put everything on one long line and it works, no idea about that one!

edit: oh it must line endings problem since i did git clone from windows.

tigros avatar Jan 12 '24 14:01 tigros