visual-semantic-embedding
visual-semantic-embedding copied to clipboard
run train.py
When I run train.trainer() .here are much mistake.Can you meet this problem?
Building model
Building f_log_probs... Done
Building f_cost... Done
Building sentence encoder
Building image encoder
Building f_grad... Building optimizers...Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydev_run_in_console.py", line 53, in run_file
pydev_imports.execfile(file, globals, locals) # execute the script
File "/Users/jiapei.fjp/Documents/python_project/vsepp/visual-semantic-embedding/run.py", line 9, in
Loading dataset Creating dictionary Dictionary size: 1 Building model OrderedDict([('Wemb', Wemb), ('encoder_W', encoder_W), ('encoder_b', encoder_b), ('encoder_U', encoder_U), ('encoder_Wx', encoder_Wx), ('encoder_Ux', encoder_Ux), ('encoder_bx', encoder_bx), ('ff_image_W', ff_image_W), ('ff_image_b', ff_image_b)]) tparams.type = OrderedDict([('Wemb', Wemb), ('encoder_W', encoder_W), ('encoder_b', encoder_b), ('encoder_U', encoder_U), ('encoder_Wx', encoder_Wx), ('encoder_Ux', encoder_Ux), ('encoder_bx', encoder_bx), ('ff_image_W', ff_image_W), ('ff_image_b', ff_image_b)]) Building f_log_probs... Done Building f_cost... Done Building sentence encoder Building image encoder Building f_grad... Building optimizers... 1 Traceback (most recent call last): File "/home/pjx/anaconda3/lib/python3.6/site-packages/theano/compile/pfunc.py", line 193, in rebuild_collect_shared allow_convert=False) File "/home/pjx/anaconda3/lib/python3.6/site-packages/theano/tensor/type.py", line 234, in filter_variable self=self)) TypeError: Cannot convert Type TensorType(float64, matrix) (of Variable Elemwise{add,no_inplace}.0) into Type TensorType(float32, matrix). You can try to manually convert Elemwise{add,no_inplace}.0 into a TensorType(float32, matrix).
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "train.py", line 225, in
I face the same issue with u now.would you solve it, please?
In optim.py change gshared to gshared = [theano.shared(p.get_value().astype('float32'), name='%s_grad'%k) for k, p in tparams.items()]
and in the loop that appends values to 'updates' add: m = theano.shared(p.get_value().astype(numpy.float32)) v = theano.shared(p.get_value().astype(numpy.float32))