ganspace icon indicating copy to clipboard operation
ganspace copied to clipboard

AttributeError: 'TorchImageView' object has no attribute 't_last'

Open laviofer opened this issue 4 years ago • 7 comments

Error when running interactive.py. I get two TK windows opened, and then immediately shut down with the error below.

Ubuntu 20.04, Python 3.7.9, NVidia, Cuda 10.1.243, pyCuda from source, compiled with gl enabled, version 2020.1

#python interactive.py --model=BigGAN-512 --class=husky --layer=generator.gen_z -n=1_000_000
StyleGAN2: Optimized CUDA op FusedLeakyReLU not available, using native PyTorch fallback.
StyleGAN2: Optimized CUDA op UpFirDn2d not available, using native PyTorch fallback.
Loaded components for husky from /home/ofer/ganspace/ganspace/cache/components/biggan-512-husky_generator.gen_z_ipca_c80_n1000000.npz
Seed: 316727503
GLX version: 1.4
Screen is  0
Number of FBconfigs 260
Got a matching visual: index 104 33 xid 0x21
Is Direct?:  1
Done making a first context
Exception in Tkinter callback
Traceback (most recent call last):
  File "/home/ofer/anaconda3/envs/ganspace/lib/python3.7/tkinter/__init__.py", line 1705, in __call__
    return self.func(*args)
  File "/home/ofer/anaconda3/envs/ganspace/lib/python3.7/site-packages/pyopengltk/base.py", line 30, in tkMap
    self.initgl()
  File "/home/ofer/ganspace/ganspace/TkTorchWindow.py", line 75, in initgl
    self.setup_gl(self.width, self.height)
  File "/home/ofer/ganspace/ganspace/TkTorchWindow.py", line 88, in setup_gl
    import pycuda.gl.autoinit
  File "/home/ofer/anaconda3/envs/ganspace/lib/python3.7/site-packages/pycuda-2020.1-py3.7-linux-x86_64.egg/pycuda/gl/autoinit.py", line 9, in <module>
    context = make_default_context(lambda dev: cudagl.make_context(dev))
  File "/home/ofer/anaconda3/envs/ganspace/lib/python3.7/site-packages/pycuda-2020.1-py3.7-linux-x86_64.egg/pycuda/tools.py", line 205, in make_default_context
    "on any of the %d detected devices" % ndevices)
RuntimeError: make_default_context() wasn't able to create a context on any of the 1 detected devices
Exception in Tkinter callback
Traceback (most recent call last):
  File "/home/ofer/anaconda3/envs/ganspace/lib/python3.7/tkinter/__init__.py", line 1705, in __call__
    return self.func(*args)
  File "/home/ofer/anaconda3/envs/ganspace/lib/python3.7/site-packages/pyopengltk/base.py", line 74, in tkExpose
    self._display()
  File "/home/ofer/anaconda3/envs/ganspace/lib/python3.7/site-packages/pyopengltk/base.py", line 98, in _display
    self.redraw()
  File "/home/ofer/ganspace/ganspace/TkTorchWindow.py", line 141, in redraw
    dt = t_now - self.t_last
AttributeError: 'TorchImageView' object has no attribute 't_last'
Traceback (most recent call last):
  File "interactive.py", line 651, in <module>
    app.update()
  File "/home/ofer/ganspace/ganspace/TkTorchWindow.py", line 198, in update
    self.redraw()
  File "/home/ofer/ganspace/ganspace/TkTorchWindow.py", line 141, in redraw
    dt = t_now - self.t_last
AttributeError: 'TorchImageView' object has no attribute 't_last'


laviofer avatar Jan 09 '21 20:01 laviofer

did you found the solution? I facing same issue

alfinnurhalim avatar Jan 17 '21 14:01 alfinnurhalim

Same here. This is the top result in google for "TorchImageView t_last"

During setup I also had a problem at this stage:

python configure.py --cuda-enable-gl --cuda-root=/path/to/cuda

gave me "configure.py: error: no such option: --cuda-enable-gl"

so I remever that option.

Are the two issues linked?

I tried wrapping that first error in a try/except but then I just got another error.

andybak avatar Jan 25 '21 13:01 andybak

I'm also having the same problem. Windows laptop nvidia video card, latest packages installed manually from deps/windows, but NOT any of the instructions under StyleGAN2.

I did notice these lines that might be significant:

(ganspace) C:\Users\mexin\Dropbox\Other_Peoples_Repos\ganspace>python interactive.py --model=BigGAN-512 --class=husky --layer=generator.gen_z -n=1_000_000
INFO: Could not find files for the given pattern(s).
StyleGAN2: Optimized CUDA op FusedLeakyReLU not available, using native PyTorch fallback.
StyleGAN2: Optimized CUDA op UpFirDn2d not available, using native PyTorch fallback.

I have screencapped the error output and the window popping up and immediately closing here: http://somup.com/creF61bbHS

What could the next step be?

DataStrategist avatar Mar 18 '21 10:03 DataStrategist

Got it to run. It was my multiple monitor setup. As soon as I disconnected them, it worked.

DataStrategist avatar Mar 18 '21 11:03 DataStrategist

I got the same error when i try the command : python interactive.py --model=BigGAN-512 --class=husky --layer=generator.gen_z -n=1_000_000

Response:

INFO: Could not find files for the given pattern(s). StyleGAN2: Optimized CUDA op FusedLeakyReLU not available, using native PyTorch fallback. StyleGAN2: Optimized CUDA op UpFirDn2d not available, using native PyTorch fallback. Loaded components for husky from C:\Users\giri\OneDrive\Documents\Development\Research\Github Repos\ganspace\cache\components\biggan-512-husky_generator.gen_z_ipca_c80_n1000000.npz Seed: 1987189412 Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\giri\anaconda3\envs\ganspace\lib\tkinter_init_.py", line 1705, in call return self.func(*args) File "C:\Users\giri\anaconda3\envs\ganspace\lib\site-packages\pyopengltk\base.py", line 30, in tkMap self.initgl() File "C:\Users\giri\OneDrive\Documents\Development\Research\Github Repos\ganspace\TkTorchWindow.py", line 75, in initgl self.setup_gl(self.width, self.height) File "C:\Users\giri\OneDrive\Documents\Development\Research\Github Repos\ganspace\TkTorchWindow.py", line 88, in setup_gl import pycuda.gl.autoinit File "C:\Users\giri\anaconda3\envs\ganspace\lib\site-packages\pycuda\gl\autoinit.py", line 9, in context = make_default_context(lambda dev: cudagl.make_context(dev)) File "C:\Users\giri\anaconda3\envs\ganspace\lib\site-packages\pycuda\tools.py", line 204, in make_default_context "on any of the %d detected devices" % ndevices) RuntimeError: make_default_context() wasn't able to create a context on any of the 1 detected devices Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\giri\anaconda3\envs\ganspace\lib\tkinter_init_.py", line 1705, in call return self.func(*args) File "C:\Users\giri\anaconda3\envs\ganspace\lib\site-packages\pyopengltk\base.py", line 74, in tkExpose self._display() File "C:\Users\giri\anaconda3\envs\ganspace\lib\site-packages\pyopengltk\base.py", line 98, in _display self.redraw() File "C:\Users\giri\OneDrive\Documents\Development\Research\Github Repos\ganspace\TkTorchWindow.py", line 141, in redraw dt = t_now - self.t_last AttributeError: 'TorchImageView' object has no attribute 't_last' Traceback (most recent call last): File "interactive.py", line 651, in app.update() File "C:\Users\giri\OneDrive\Documents\Development\Research\Github Repos\ganspace\TkTorchWindow.py", line 198, in update self.redraw() File "C:\Users\giri\OneDrive\Documents\Development\Research\Github Repos\ganspace\TkTorchWindow.py", line 141, in redraw dt = t_now - self.t_last AttributeError: 'TorchImageView' object has no attribute 't_last'

giritlgc avatar Mar 19 '21 13:03 giritlgc

Same here. This is the top result in google for "TorchImageView t_last"

During setup I also had a problem at this stage:

python configure.py --cuda-enable-gl --cuda-root=/path/to/cuda

gave me "configure.py: error: no such option: --cuda-enable-gl"

so I remever that option.

Are the two issues linked?

I tried wrapping that first error in a try/except but then I just got another error.

I'm in your same situation, got the error: no such option: --cuda-enable-gl", removed the --cuda-enable-gl to make it run, but receive the no attribute 't_last' error when running.

alessandrodignani avatar Jun 19 '21 10:06 alessandrodignani

I have the same problem, has anyone solved it?

Cecil-x avatar Jul 27 '22 08:07 Cecil-x