junyanz / iGAN

Interactive Image Generation via Generative Adversarial Networks
MIT License
3.97k stars 587 forks source link

Cannot run cuda with version 8.0 #1

Closed tzatter closed 7 years ago

tzatter commented 7 years ago

Ubuntu16.04 GTX960 2G

Traceback (most recent call last): File "iGAN_main.py", line 38, in model_G = model_class.Model(model_name=args.model_name, model_file=args.model_file) File "/home/tzatter/iGAN/model_def/dcgan_theano.py", line 24, in init self._gen = self.def_gen(self.gen_params, self.gen_pl, self.n_layers, self.n_f) File "/home/tzatter/iGAN/model_def/dcgan_theano.py", line 34, in def_gen gx = gen_test(z, gen_params, gen_pl, n_layers=n_layers, n_f=n_f) File "/home/tzatter/iGAN/model_def/dcgan_theano.py", line 319, in gen_test hout = relu(batchnorm(deconv(hin, w, subsample=(2, 2), border_mode=(2, 2)), u=u, s=s, g=g, b=b)) File "/home/tzatter/iGAN/lib/ops.py", line 90, in deconv img = gpu_contiguous(X) File "/usr/local/lib/python2.7/dist-packages/theano/gof/op.py", line 602, in call node = self.make_node(_inputs, _kwargs) File "/usr/local/lib/python2.7/dist-packages/theano/sandbox/cuda/basic_ops.py", line 3963, in make_node input = as_cuda_ndarray_variable(input) File "/usr/local/lib/python2.7/dist-packages/theano/sandbox/cuda/basic_ops.py", line 46, in as_cuda_ndarray_variable return gpu_from_host(tensor_x) File "/usr/local/lib/python2.7/dist-packages/theano/gof/op.py", line 602, in call node = self.make_node(_inputs, _kwargs) File "/usr/local/lib/python2.7/dist-packages/theano/sandbox/cuda/basic_ops.py", line 139, in make_node dtype=x.dtype)()]) File "/usr/local/lib/python2.7/dist-packages/theano/sandbox/cuda/type.py", line 95, in init (self.class.name, dtype, name)) TypeError: CudaNdarrayType only supports dtype float32 for now. Tried using dtype float64 for variable None

Jun-Yan Zhu, thank you for the awesome code.

tzatter commented 7 years ago

A problem is solved by adding this parameter $ THEANO_FLAGS='floatX=float32' python iGAN_main.py

junyanz commented 7 years ago

Yes, you have to use Theano flags like:

THEANO_FLAGS='device=gpu0, floatX=float32, nvcc.fastmath=True' python ...

If you are familiar with Theano, you can also add config.lib.cnmem=0.8 to slightly boost the fps. More information on Theano flags can be found here