zhenxuan00 / triple-gan

See Triple-GAN-V2 in PyTorch: https://github.com/taufikxu/Triple-GAN
226 stars 60 forks source link

Bug in the code #1

Open mrgzadeh opened 7 years ago

mrgzadeh commented 7 years ago

I try to run your code on the MNIST dataset, however I get a strange error as soon as the pre-training has finished. I really appreciate any guidance. Thanks!

The error is as follows:

Traceback (most recent call last): File "x2y_yz2x_xy2p_ssl_mnist.py", line 462, in cl_b = train_batch_cla(x_labelled[from_l_c:to_l_c], y_labelled[from_l_c:to_l_c], sample_y, p_u[from_u_c:to_u_c], alpha_cla_g, lr, alpha_unlabeled_entropy, alpha_average) File "/home/mehdi/anaconda3/envs/python2/lib/python2.7/site-packages/theano/compile/function_module.py", line 871, in call storage_map=getattr(self.fn, 'storage_map', None)) File "/home/mehdi/anaconda3/envs/python2/lib/python2.7/site-packages/theano/gof/link.py", line 314, in raise_with_op reraise(exc_type, exc_value, exc_trace) File "/home/mehdi/anaconda3/envs/python2/lib/python2.7/site-packages/theano/compile/function_module.py", line 859, in call outputs = self.fn() ValueError: GpuElemwise. Input dimension mis-match. Input 1 (indices start at 0) has shape[0] == 1, but the output's size on that axis is 100. Apply node that caused the error: GpuElemwise{Composite{((((i0 i1) + ((i2 i3 i4) / i5)) + ((i2 i6 i3 i7) / (i5 i8))) + i9)},no_inplace}(GpuElemwise{Composite{Cast{float32}(EQ(i0, i1))},no_inplace}.0, GpuDimShuffle{0,x}.0, CudaNdarrayConstant{[[-1.]]}, GpuDimShuffle{x,x}.0, GpuElemwise{log,no_inplace}.0, GpuDimShuffle{x,x}.0, GpuElemwise{Composite{Cast{float32}(AND(GE(i0, i1), LE(i0, i2)))},no_inplace}.0, GpuSoftmaxWithBias.0, GpuElemwise{clip,no_inplace}.0, GpuElemwise{Composite{((i0 (i1 / i2)) / i3)},no_inplace}.0) Toposort index: 1145 Inputs types: [CudaNdarrayType(float32, matrix), CudaNdarrayType(float32, col), CudaNdarrayType(float32, (True, True)), CudaNdarrayType(float32, (True, True)), CudaNdarrayType(float32, matrix), CudaNdarrayType(float32, (True, True)), CudaNdarrayType(float32, matrix), CudaNdarrayType(float32, matrix), CudaNdarrayType(float32, matrix), CudaNdarrayType(float32, row)] Inputs shapes: [(100, 10), (1, 1), (1, 1), (1, 1), (100, 10), (1, 1), (100, 10), (100, 10), (100, 10), (1, 10)] Inputs strides: [(10, 1), (0, 0), (0, 0), (0, 0), (10, 1), (0, 0), (10, 1), (10, 1), (10, 1), (0, 1)] Inputs values: ['not shown', CudaNdarray([[ 0.41114426]]), CudaNdarray([[-1.]]), CudaNdarray([[ 0.30000001]]), 'not shown', CudaNdarray([[ 100.]]), 'not shown', 'not shown', 'not shown', 'not shown'] Outputs clients: [[GpuDimShuffle{0,1,x,x}(GpuElemwise{Composite{((((i0 i1) + ((i2 i3 i4) / i5)) + ((i2 i6 i3 i7) / (i5 * i8))) + i9)},no_inplace}.0)]]

HINT: Re-running with most Theano optimization disabled could give you a back-trace of when this node was created. This can be done with by setting the Theano flag 'optimizer=fast_compile'. If that does not work, Theano optimizations can be disabled with 'optimizer=None'. HINT: Use the Theano flag 'exception_verbosity=high' for a debugprint and storage map footprint of this apply node.

share123321 commented 7 years ago

Same problem.

taufikxu commented 6 years ago

Can you give me more details about your environment? The code is fine with my environment which is shown as follows: OS: Ubuntu 16.04 GPU: 1080 Ti Cuda: 8.0, Cudnn: 7.03 Python: 2.7.14 Theano: 0.9.0.dev-c697eeab84e5b8a74908da654b66ec9eca4f1291

The python environment is built using miniconda2. Let me know if the above setting still doesn't work.

dmortem commented 6 years ago

Hi, @taufikxu I failed to load the pre-trained model when I run 'python x2y_yz2x_xy2p_ssl_mnist.py -oldmodel=./results-ssl/x2y_yz2x_xy2p_ssl_mnist.ssl_seed1.nlabeled48.objective_flagargmax.1541578688/model_epoch1000.npy' There is no error in the code, but it seems the code doesn't really load the pre-trained model. I wonder how to solve it? Thanks a lot!