memray / seq2seq-keyphrase

MIT License
318 stars 109 forks source link

runtime error in training process #12

Closed leexian closed 6 years ago

leexian commented 6 years ago

Traceback (most recent call last): File "keyphrasecopynet.py", line 262, in agent.compile('all') File "/home/developer/seq2seq-keyphrase/emolga/models/covcencdec.py", line 1849, in compile self.compile_train() File "/home/developer/seq2seq-keyphrase/emolga/models/covc_encdec.py", line 1880, in compile_train logPxz, logPPL = self.decoder.build_decoder(target, cc_matrix, code, c_mask) File "/home/developer/seq2seq-keyphrase/emolga/models/covc_encdec.py", line 996, in build_decoder non_sequences=[context, c_mask, context_A] File "/home/developer/anaconda3/lib/python3.6/site-packages/theano/scan_module/scan.py", line 1076, in scan scan_outs = local_op(scan_inputs) File "/home/developer/anaconda3/lib/python3.6/site-packages/theano/gof/op.py", line 615, in call node = self.make_node(inputs, **kwargs) File "/home/developer/anaconda3/lib/python3.6/site-packages/theano/scan_module/scan_op.py", line 546, in make_node inner_sitsot_out.type.dtype)) ValueError: When compiling the inner function of scan the following error has been encountered: The initial state (outputs_info in scan nomenclature) of variable IncSubtensor{Set;:int64:}.0 (argument number 5) has dtype float32, while the result of the inner function (fn) has dtype float64. This can happen if the inner function of scan results in an upcast or downcast.

leexian commented 6 years ago

I got the above runtime error when I tried the training process. How can I fix that dtype mismatch error?

Taosky commented 6 years ago

Set theano flags to float32. Run THEANO_FLAGS='floatX=float32' python keyphrase/keyphrase_copynet.py.

memray commented 6 years ago

@Taosky is correct. Also, you can create a config file .theanorc like this for convenience.