aditya1503 / Siamese-LSTM

Siamese Recurrent Neural network with LSTM for evaluating semantic similarity between sentences.
200 stars 68 forks source link

Failed to train a new model with Theano error #8

Closed liuenda closed 8 years ago

liuenda commented 8 years ago

During the training in example3, a error occurs and I failed to figure it out.Could do please help me? Thanks!


TypeError Traceback (most recent call last) /home/liu/Siamese-LSTM/example3.py in () 3 #Syn_aug=True # it False faster but does slightly worse on Test dataset 4 ----> 5 sls=lstm("new.p",load=False,training=True) 6 7 train=pickle.load(open("stsallrmf.p","rb"))#[:-8]

/home/liu/Siamese-LSTM/lstm.pyc in init(self, nam, load, training) 297 grads.append(grads[i]) 298 --> 299 self.f_grad_shared, self.f_update = adadelta(lr, tnewp, grads,emb11,mask11,emb21,mask21,y, cost) 300 301

/home/liu/Siamese-LSTM/lstm.pyc in adadelta(lr, tparams, grads, emb11, mask11, emb21, mask21, y, cost) 186 187 f_grad_shared = theano.function([emb11,mask11,emb21,mask21,y], cost, updates=zgup + rg2up, --> 188 name='adadelta_f_grad_shared') 189 190 updir = [-tensor.sqrt(ru2 + 1e-6) / tensor.sqrt(rg2 + 1e-6) * zg

/home/liu/.pyenv/versions/anaconda2-4.1.0/lib/python2.7/site-packages/theano/compile/function.pyc in function(inputs, outputs, mode, updates, givens, no_default_updates, accept_inplace, name, rebuild_strict, allow_input_downcast, profile, on_unused_input) 318 on_unused_input=on_unused_input, 319 profile=profile, --> 320 output_keys=output_keys) 321 # We need to add the flag check_aliased inputs if we have any mutable or 322 # borrowed used defined inputs

/home/liu/.pyenv/versions/anaconda2-4.1.0/lib/python2.7/site-packages/theano/compile/pfunc.pyc in pfunc(params, outputs, mode, updates, givens, no_default_updates, accept_inplace, name, rebuild_strict, allow_input_downcast, profile, on_unused_input, output_keys) 440 rebuild_strict=rebuild_strict, 441 copy_inputs_over=True, --> 442 no_default_updates=no_default_updates) 443 # extracting the arguments 444 input_variables, cloned_extended_outputs, other_stuff = output_vars

/home/liu/.pyenv/versions/anaconda2-4.1.0/lib/python2.7/site-packages/theano/compile/pfunc.pyc in rebuild_collect_shared(outputs, inputs, replace, updates, rebuild_strict, copy_inputs_over, no_default_updates) 205 ' function to remove broadcastable dimensions.') 206 --> 207 raise TypeError(err_msg, err_sug) 208 assert update_val.type == store_into.type 209

TypeError: ('An update must have the same type as the original shared variable (shared_var=1lstm1_U_rgrad2, shared_var.type=TensorType(float32, matrix), update_val=Elemwise{add,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.')

liuenda commented 8 years ago

solve by re-configure the Theano and CUDA, or we can avoid this problem by only using CPU to calculate

poornagurram commented 7 years ago

Facing the Same issue can you please tell me what changes have to be made. Thank you.