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

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

Open
laviofer opened this issue Jan 9, 2021 · 7 comments
Open

Comments

@laviofer
Copy link

laviofer commented Jan 9, 2021

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'


@alfinnurhalim
Copy link

alfinnurhalim commented Jan 17, 2021

did you found the solution? I facing same issue

@andybak
Copy link

andybak commented Jan 25, 2021

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.

@DataStrategist
Copy link

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

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

@giritlgc
Copy link

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'

@alessandrodignani
Copy link

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.

@Cecil-x
Copy link

Cecil-x commented Jul 27, 2022

I have the same problem, has anyone solved 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

7 participants