stdcoutzyx/DeepID_FaceClassify

see run error on deepid_class.py with theano both 0.7 or 0.6

Closed this issue · 2 comments

ubgpu@ubgpu:~/PycharmProjects/deepID/DeepID_FaceClassify/src/conv_net$ python deepid_class.py ../../../../../big_data/youtube_face/YouTubeFaces/test_vector_folder ../../../../../big_data/youtube_face/YouTubeFaces/train_vector_folder ../../../../../big_data/youtube_face/YouTubeFaces/params_file

if on theano0.6
Using gpu device 0: GeForce GTX 970
loading data ...
train_x: (31900, 7755)
train_y: Shape.0
valid_x: (7975, 7755)
valid_y: Shape.0
building the model ...
Traceback (most recent call last):
File "deepid_class.py", line 257, in
simple_deepid(learning_rate=0.01, n_epochs=20, dataset=(sys.argv[1], sys.argv[2]), params_file=sys.argv[3], nkerns=[20,40,60,80], batch_size=500, n_hidden=160, n_out=1595, acti_func=relu)
File "deepid_class.py", line 245, in simple_deepid
deepid.build_train_model()
File "deepid_class.py", line 193, in build_train_model
self.y: self.train_set_y[self.index * self.batch_size : (self.index+1) * self.batch_size]}
File "/usr/local/lib/python2.7/dist-packages/theano/compile/function.py", line 266, in function
profile=profile)
File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 489, in pfunc
no_default_updates=no_default_updates)
File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 217, in rebuild_collect_shared
raise TypeError(err_msg, err_sug)
TypeError: ('An update must have the same type as the original shared variable (shared_var=W, shared_var.type=CudaNdarrayType(float32, matrix), update_val=Elemwise{sub,no_inplace}.0, update_val.type=TensorType(float64, matrix)).', 'If the difference is related to the broadcast pattern, you can call the tensor.unbroadcast(var, axis_to_unbroadcast[, ...]) function to remove broadcastable dimensions.')
ubgpu@ubgpu:/PycharmProjects/deepID/DeepID_FaceClassify/src/conv_net$
ubgpu@ubgpu:
/PycharmProjects/deepID/DeepID_FaceClassify/src/conv_net$

"ykreadme" 63L, 3552C written
ubgpu@ubgpu:/PycharmProjects/deepID$
ubgpu@ubgpu:
/PycharmProjects/deepID$

Ok, from the message, we can see it's a TypeError. The shared variable's type is float32, but the update rule's type is float64. I have noticed that u have used a GTX GPU, whereas i haven't.
I think, the problem is the type of your system and the GPU is not the same, one is 64bit and one is 32bit.
First method, u can change the .theanorc file which contains your GPU info, change the floatX to float64. Second method, u can just leave the GPU out, just use your cpu.
I hope these can solve your problems.

it works by change .theanorc
floatX = float64 --original is 32