seya
seya copied to clipboard
GAN Example errors when compiling detector
Hi, I'm really interested in building GANs with keras and noticed you had an awesome ipython notebook walking through a simple one. But when I run it, I get this error
Traceback (most recent call last):
File "./seyaGAN.py", line 80, in <module>
detector.compile(loss='binary_crossentropy', optimizer=opt_d)
File "/Users/user/venv/kerasGAN/lib/python2.7/site-packages/keras/models.py", line 453, in compile
self._train = K.function(train_ins, [train_loss], updates=updates)
File "/Users/user/venv/kerasGAN/lib/python2.7/site-packages/keras/backend/theano_backend.py", line 369, in function
return Function(inputs, outputs, updates=updates)
File "/Users/user/venv/kerasGAN/lib/python2.7/site-packages/keras/backend/theano_backend.py", line 362, in __init__
allow_input_downcast=True, **kwargs)
File "/Users/user/venv/kerasGAN/lib/python2.7/site-packages/theano/compile/function.py", line 317, in function
output_keys=output_keys)
File "/Users/user/venv/kerasGAN/lib/python2.7/site-packages/theano/compile/pfunc.py", line 526, in pfunc
output_keys=output_keys)
File "/Users/user/venv/kerasGAN/lib/python2.7/site-packages/theano/compile/function_module.py", line 1777, in orig_function
output_keys=output_keys).create(
File "/Users/user/venv/kerasGAN/lib/python2.7/site-packages/theano/compile/function_module.py", line 1416, in __init__
self._check_unused_inputs(inputs, outputs, on_unused_input)
File "/Users/user/venv/kerasGAN/lib/python2.7/site-packages/theano/compile/function_module.py", line 1554, in _check_unused_inputs
i.variable, err_msg))
theano.compile.function_module.UnusedInputError: theano.function was asked to create a function computing outputs given certain inputs, but the provided input variable at index 0 is not part of the computational graph needed to compute the outputs: sigmoid.0.
I'm running OS X Yosemite on 10.10.5. I've copy pasted the code parts of the ipython notebook into a python file and ran python ./seyaGAN. I'm running python 2.7.11 and using keras 0.3.1 with theano 0.7.0.dev-3dcba54db7d32f0efe71b5e93b62fc9df6864263
Any idea on what that could be related to?
Also what does this line mean?
detector.add(Dense(1)) # 1: Yes, it belongs to S, 0: fake!
Thanks!
Hi, thanks for the interest in Seya. I started to get similar erros. I think there is a recent problem with Keras when using Sequential models as nodes or layers.
@farizrahman4u did you observe similar problems like those in Keras recently? I'll make a formal PR over there to show what I mean. But let me know if you already know of anything like that.
So I've reworked your example to use https://github.com/phreeza/keras-GAN/blob/master/simple_conv_gan_EC2.py style models. So i've got a sampler and detector model and then just build an overall model with those as layers. This does note error so I think it has something to do with the
sample_fake = theano.function([sampler.get_input()], sampler.get_output())
part.