DragGAN icon indicating copy to clipboard operation
DragGAN copied to clipboard

RuntimeError: Tried to instantiate dummy base class Event

Open uwings opened this issue 1 year ago • 13 comments

实在不太清楚是那有问题了,大会帮忙吧,困死了

(base) E:\DragGAN>pip list
Package                 Version
----------------------- ------------
boltons                 23.0.0
brotlipy                0.7.0
certifi                 2023.5.7
cffi                    1.15.1
charset-normalizer      2.0.4
colorama                0.4.6
conda                   23.5.0
conda-content-trust     0.1.3
conda-package-handling  2.1.0
conda_package_streaming 0.8.0
cryptography            39.0.1
filelock                3.12.2
idna                    3.4
Jinja2                  3.1.2
jsonpatch               1.32
jsonpointer             2.1
MarkupSafe              2.1.3
menuinst                1.4.19
mpmath                  1.3.0
networkx                3.1
numpy                   1.25.0
packaging               23.0
Pillow                  9.5.0
pip                     23.1.2
pluggy                  1.0.0
pycosat                 0.6.4
pycparser               2.21
pyOpenSSL               23.0.0
PySocks                 1.7.1
requests                2.29.0
ruamel.yaml             0.17.21
ruamel.yaml.clib        0.2.6
setuptools              65.6.3
six                     1.16.0
sympy                   1.12
toolz                   0.12.0
torch                   2.0.1+cu118
torchaudio              2.0.2+cu118
torchvision             0.15.2+cu118
tqdm                    4.65.0
typing_extensions       4.6.3
urllib3                 1.26.16
wheel                   0.37.1
win-inet-pton           1.1.0
wincertstore            0.2
zstandard               0.19.0
$ sh scripts/gui.sh
No CUDA runtime is found, using CUDA_HOME='C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1'
Traceback (most recent call last):
  File "E:\DragGAN\visualizer_drag.py", line 402, in <module>
    main()
  File "C:\Users\***\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\***\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "C:\Users\***\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\***\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "E:\DragGAN\visualizer_drag.py", line 396, in main
    viz.draw_frame()
  File "E:\DragGAN\visualizer_drag.py", line 168, in draw_frame
    self._async_renderer.set_args(**self.args)
  File "E:\DragGAN\visualizer_drag.py", line 294, in set_args
    self._set_args_sync(**args)
  File "E:\DragGAN\visualizer_drag.py", line 311, in _set_args_sync
    self._renderer_obj = renderer.Renderer()
  File "E:\DragGAN\viz\renderer.py", line 78, in __init__
    self._start_event   = torch.cuda.Event(enable_timing=True)
  File "C:\Users\***\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\cuda\streams.py", line 164, in __new__
    return super(Event, cls).__new__(
  File "C:\Users\***\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\cuda\_utils.py", line 46, in err_fn
    raise RuntimeError(
RuntimeError: Tried to instantiate dummy base class Event

uwings avatar Jun 25 '23 19:06 uwings

Have same issue on anaconda of windows and failed to find way to solve it. The Event classes are only used to record elapsing time. Quick fix: try to bypass the errors by commenting out self._start_event and self._end_event related code in viz.renderer.

raiden2012 avatar Jun 26 '23 01:06 raiden2012

Have same issue on anaconda of windows and failed to find way to solve it. The Event classes are only used to record elapsing time. Quick fix: try to bypass the errors by commenting out self._start_event and self._end_event related code in viz.renderer.

it worked , thx bro. I follow you advise, success by pass the errors. but i have another errors like torch and cuda things , work on it , thank alot

uwings avatar Jun 26 '23 05:06 uwings

Yes, after commenting, this error: \Python310\lib\site-packages\torch\cuda_init_.py", line 239, in _lazy_init
raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled

denled79 avatar Jun 26 '23 09:06 denled79

Yes, after commenting, this error: \Python310\lib\site-packages\torch\cuda__init__.py", line 239, in _lazy_init raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled

Try install torch with cuda support if it doesn't. My cmd is pip install torch==2.0.1+cu118 --extra-index-url https://download.pytorch.org/whl/cu118

raiden2012 avatar Jun 26 '23 13:06 raiden2012

Hello, same error here. Could you please let me know how to comment out "self._start_event" and "self._end_event" in "renderer.py" and why they are related to "\anaconda3\lib\site-packages\torch\cuda_utils.py"? Thank you for your support.

Rickycky avatar Jun 27 '23 22:06 Rickycky

Hi all, I am getting this error:

No CUDA runtime is found, using CUDA_HOME='C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8' Traceback (most recent call last): File "C:\Users\apext\Downloads\DragGan\DragGAN\visualizer_drag.py", line 403, in main() File "C:\Users\apext\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1130, in call return self.main(*args, **kwargs) File "C:\Users\apext\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1055, in main rv = self.invoke(ctx) File "C:\Users\apext\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1404, in invoke return ctx.invoke(self.callback, **ctx.params) File "C:\Users\apext\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 760, in invoke return __callback(*args, **kwargs) File "C:\Users\apext\Downloads\DragGan\DragGAN\visualizer_drag.py", line 397, in main viz.draw_frame() File "C:\Users\apext\Downloads\DragGan\DragGAN\visualizer_drag.py", line 168, in draw_frame self._async_renderer.set_args(**self.args) File "C:\Users\apext\Downloads\DragGan\DragGAN\visualizer_drag.py", line 295, in set_args self._set_args_sync(**args) File "C:\Users\apext\Downloads\DragGan\DragGAN\visualizer_drag.py", line 312, in _set_args_sync self._renderer_obj = renderer.Renderer() File "C:\Users\apext\Downloads\DragGan\DragGAN\viz\renderer.py", line 80, in init self._start_event = torch.cuda.Event(enable_timing=True) File "C:\Users\apext\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\cuda\streams.py", line 164, in new return super(Event, cls).new( File "C:\Users\apext\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\cuda_utils.py", line 46, in err_fn raise RuntimeError( RuntimeError: Tried to instantiate dummy base class Event Press any key to continue. . .

OtakuOW avatar Jun 30 '23 15:06 OtakuOW

How can I solve this problem? If you can show me pictures where you show me how it is, it would be better because I'm not very familiar with these things XD

OtakuOW avatar Jun 30 '23 15:06 OtakuOW

Try python -c "import torch; print(torch.version)" for torch version. The "event error" is not actual error. For my case there was torch+CPU installation instead torch+CUDA.

P.S. There error in requirement.txt Line like "torch>=2.0.0" install cpu vesrion. Change it to something like "torch>=2.0.0+cu111" for gpu version installation.

Vadim2S avatar Jul 12 '23 08:07 Vadim2S

How can I solve this problem? If you can show me pictures where you show me how it is, it would be better because I'm not very familiar with these things XD

For example, in viz/renderer.py, let "disable_timing = True", which could comment out both of them. It works, but I still don't know other more useful functions.

SMFZYK avatar Jul 20 '23 08:07 SMFZYK

hello, unfortunately I was not able to understand what you told me. I asked if you could kindly take pictures of the various procedures, since I'm not really familiar with these things. BUT nothing done. Oh well, thanks anyway

OtakuOW avatar Jul 20 '23 12:07 OtakuOW

Sorry for delay. I am on vacation now.

Answer:

  1. This is not project error
  2. This may be invalid environment error
  3. CUDA version of PyTorch required
  4. Check you PyTorch version
  5. Install right PyTorch+CUDA version

P.S. If you use this project requirements.txt file - you get wrong pytorch version installed (CPU)

Vadim2S avatar Aug 06 '23 11:08 Vadim2S

This worked for me pip install torch==2.1.1+cu118 --extra-index-url https://download.pytorch.org/whl/cu118

( Anaconda / Windows )

antv311 avatar Dec 09 '23 21:12 antv311

Have same issue on anaconda of windows and failed to find way to solve it. The Event classes are only used to record elapsing time. Quick fix: try to bypass the errors by commenting out self._start_event and self._end_event related code in viz.renderer.

it worked , thx bro. I follow you advise, success by pass the errors. but i have another errors like torch and cuda things , work on it , thank alot

hi,bro,I'm facing the same problem. Did you solve it?

laami121 avatar Aug 01 '24 06:08 laami121