Hello Sir,
I got again error. When i run the train_model.py.
The following error occurred.
Please help me to resolve this error.
args must be like a=X b.c=X
('current save dir ', './exp/test_non/')
./exp/test_non/ already exists!
preparing reload
('save dir ', './exp/test_non/')
('from_dir ', 'C:/Users/KARAN AGGARWAL/Downloads/workplace2/Video-Description-with-Spatial-Temporal-Attention-master/pre-trained_model/pre-trained_model/')
setting current model config with the old one
('erasing everything in ', './exp/test_non/')
saving model config into ./exp/test_non/model_config.pkl
Model Type: attention
Host: karan
Command: C:\Users\KARAN AGGARWAL\Anaconda3\lib\site-packages\ipykernel_launcher.py -f C:\Users\KARAN AGGARWAL\AppData\Roaming\jupyter\runtime\kernel-d1b6b355-6bab-4566-aa86-fc28aff0a72c.json
training an attention model
Loading data
loading youtube2text googlenet features
C:\Users\KARAN AGGARWAL\Downloads\workplace2\Video-Description-with-Spatial-Temporal-Attention-master\model_attention.py:37: UserWarning: Feeding context to output directly seems to hurt.
warnings.warn('Feeding context to output directly seems to hurt.')
uneven minibath chunking, overall 32, last one 12
uneven minibath chunking, overall 200, last one 91
uneven minibath chunking, overall 200, last one 168
init params
no lstm on ctx
Reloading model params...
buliding sampler
Building f_init... Done
building f_next...
Done
building f_log_probs
building f_alphal
building f_alphag
building f_alpham
building f_alphalt
compute grad
build train fns
TypeError Traceback (most recent call last)
~\Anaconda3\lib\site-packages\theano\compile\pfunc.py in rebuild_collect_shared(outputs, inputs, replace, updates, rebuild_strict, copy_inputs_over, no_default_updates)
192 update_val = store_into.type.filter_variable(update_val,
--> 193 allow_convert=False)
194 except TypeError:
~\Anaconda3\lib\site-packages\theano\tensor\type.py in filter_variable(self, other, allow_convert)
233 other=other,
--> 234 self=self))
235
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:
TypeError Traceback (most recent call last)
in ()
102
103 state = expand(args)
--> 104 sys.exit(main(state))
in main(state, channel)
88 def main(state, channel=None):
89 set_config(config, state)
---> 90 train_from_scratch(config, state, channel)
91
92
in train_from_scratch(config, state, channel)
81 print(('Command: %s' % ' '.join(sys.argv)))
82 if config.model == 'attention':
---> 83 model_attention.train_from_scratch(state, channel)
84 else:
85 raise NotImplementedError()
~\Downloads\workplace2\Video-Description-with-Spatial-Temporal-Attention-master\model_attention.py in train_from_scratch(state, channel)
1560 print('training an attention model')
1561 model = Attention(channel)
-> 1562 model.train(**state.attention)
1563 print('training time in total %.4f sec'%(time.time()-t0))
1564
~\Downloads\workplace2\Video-Description-with-Spatial-Temporal-Attention-master\model_attention.py in train(self, random_seed, dim_word, ctxglm_dim, ctxg_dim, ctxl_dim, ctxm_dim, dim, n_layers_out, n_layers_init, encoder, encoder_dim, prev2out, ctx2out, patience, max_epochs, dispFreq, decay_c, alpha_c, alpha_entropy_r, lrate, selector, n_words, maxlen, optimizer, clip_c, batch_size, valid_batch_size, save_model_dir, validFreq, saveFreq, sampleFreq, metric, dataset, video_feature, use_dropout, reload_, from_dir, K, OutOf, verbose, debug)
1207 f_grad_shared, f_update = eval(optimizer)(lr, tparams, grads,
1208 [x, mask, ctxg, mask_ctxg,ctxl, mask_ctxl,ctxm,mask_ctxm], cost,
-> 1209 extra + grads)
1210
1211 print('compilation took %.4f sec'%(time.time()-t0))
~\Downloads\workplace2\Video-Description-with-Spatial-Temporal-Attention-master\common.py in adadelta(lr, tparams, grads, inp, cost, extra)
185
186 f_grad_shared = theano.function(inp, [cost] + extra, updates=zgup+rg2up,
--> 187 profile=False, on_unused_input='ignore')
188
189 updir = [-tensor.sqrt(ru2 + 1e-6) / tensor.sqrt(rg2 + 1e-6) * zg for zg, ru2, rg2 in zip(zipped_grads, running_up2, running_grads2)]
~\Anaconda3\lib\site-packages\theano\compile\function.py in function(inputs, outputs, mode, updates, givens, no_default_updates, accept_inplace, name, rebuild_strict, allow_input_downcast, profile, on_unused_input)
315 on_unused_input=on_unused_input,
316 profile=profile,
--> 317 output_keys=output_keys)
318 return fn
~\Anaconda3\lib\site-packages\theano\compile\pfunc.py in pfunc(params, outputs, mode, updates, givens, no_default_updates, accept_inplace, name, rebuild_strict, allow_input_downcast, profile, on_unused_input, output_keys)
447 rebuild_strict=rebuild_strict,
448 copy_inputs_over=True,
--> 449 no_default_updates=no_default_updates)
450 # extracting the arguments
451 input_variables, cloned_extended_outputs, other_stuff = output_vars
~\Anaconda3\lib\site-packages\theano\compile\pfunc.py in rebuild_collect_shared(outputs, inputs, replace, updates, rebuild_strict, copy_inputs_over, no_default_updates)
206 ' function to remove broadcastable dimensions.')
207
--> 208 raise TypeError(err_msg, err_sug)
209 assert update_val.type == store_into.type
210
TypeError: ('An update must have the same type as the original shared variable (shared_var=Wemb_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.')