npow/MemNN

Optimization failure due to: local_gpu_careduce

Closed this issue · 2 comments

Hi! Thanks for sharing this. I tried to run this, but got some errors. I'm using Theano 0.7.0 and scikit-learn 0.16.1.

I have had success with other Theano toolkits, and the data files are correctly loaded as far as I can tell.

After printing the error below, instead of exiting the program it continues running and printing this message every now and then.

kyle:MemNN kyle$ python main.py 
Using gpu device 0: GeForce GT 750M
args:  Namespace(embedding_size=50, gamma=1, lr=0.1, n_epochs=10, task=1, test_file='', train_file='')
********************************************************************************
epoch:  0
/usr/local/lib/python2.7/site-packages/theano/scan_module/scan_perform_ext.py:133: RuntimeWarning: numpy.ndarray size changed, may indicate binary incompatibility
  from scan_perform.scan_perform import *
<<!! BUG IN FGRAPH.REPLACE OR A LISTENER !!>> <type 'exceptions.TypeError'> ('The type of the replacement must be compatible with the type of the original Variable.', Sum{acc_dtype=float64}.0, HostFromGpu.0, TensorType(float64, scalar), TensorType(float32, scalar), 'local_gpu_careduce') local_gpu_careduce
ERROR (theano.gof.opt): Optimization failure due to: local_gpu_careduce
ERROR (theano.gof.opt): TRACEBACK:
ERROR (theano.gof.opt): Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/theano/gof/opt.py", line 1527, in process_node
    fgraph.replace_all_validate(repl_pairs, reason=lopt)
  File "/usr/local/lib/python2.7/site-packages/theano/gof/toolbox.py", line 259, in replace_all_validate
    fgraph.replace(r, new_r, reason=reason, verbose=False)
  File "/usr/local/lib/python2.7/site-packages/theano/gof/fg.py", line 474, in replace
    str(reason))
TypeError: ('The type of the replacement must be compatible with the type of the original Variable.', Sum{acc_dtype=float64}.0, HostFromGpu.0, TensorType(float64, scalar), TensorType(float32, scalar), 'local_gpu_careduce')
npow commented

Try using floatX=float32. It's also faster to use CPU since this code isn't using minibatches yet.

THEANO_FLAGS=device=cpu,floatX=float32 python -u main.py

interesting, i have floatX = float32 defined in my ~/.theanorc but there must be some configuration mistake i made, because it's apparently being ignored. the solution you gave works. thanks!