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

RuntimeError: Tried to instantiate dummy base class Event #37

Open
uwings opened this issue Jun 25, 2023 · 13 comments
Open

RuntimeError: Tried to instantiate dummy base class Event #37

uwings opened this issue Jun 25, 2023 · 13 comments

Comments

@uwings
Copy link

uwings commented Jun 25, 2023

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

(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
@raiden2012
Copy link

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.

@uwings
Copy link
Author

uwings commented Jun 26, 2023

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

@denled79
Copy link

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

@raiden2012
Copy link

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

@Rickycky
Copy link

Rickycky commented Jun 27, 2023

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.

@OtakuOW
Copy link

OtakuOW commented Jun 30, 2023

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
Copy link

OtakuOW commented Jun 30, 2023

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

@Vadim2S
Copy link

Vadim2S commented Jul 12, 2023

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.

@SMFZYK
Copy link

SMFZYK commented Jul 20, 2023

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.

@OtakuOW
Copy link

OtakuOW commented Jul 20, 2023

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

@Vadim2S
Copy link

Vadim2S commented Aug 6, 2023

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)

@antv311
Copy link

antv311 commented Dec 9, 2023

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

( Anaconda / Windows )

@laami121
Copy link

laami121 commented Aug 1, 2024

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?

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

9 participants