pointer-generator
pointer-generator copied to clipboard
Error about 'Matrix already exists' under decode mode.
Thanks for your impressive work.
In fact, I am trying to modify something about this structure, while I did not modify anything about attention mechanism. After I train my new model successfully, I met some error in decode mode about attention. Errors are represented like follow:
`Traceback (most recent call last):
File "F:/study/project/pointer-generator-master/run_summarization.py", line 329, in
File "F:\ANACONDA\lib\site-packages\tensorflow\python\framework\ops.py", line 1470, in init self._traceback = self._graph._extract_stack() # pylint: disable=protected-access File "F:\ANACONDA\lib\site-packages\tensorflow\python\framework\ops.py", line 2956, in create_op op_def=op_def) File "F:\ANACONDA\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper op_def=op_def)0`
I thought there may be some error in your linear function.Could you please provide some help? Thanks a lot.
@xiyan524 , it looks like you've copied part of the model and re-used it without changing its name.
Yeah, I got that from the error information. I think the error mainly comes from
File "F:\study\project\pointer-generator-master\attention_decoder.py", line 276, in linear matrix = tf.get_variable("Matrix", [total_arg_size, output_size])
I mean linear function has been used for serveral times, so Matrix definitely will be re-used. I am not sure this thought is correct or not?
Can you post the diff of your changes? It's hard to guess without knowing what you've done, especially since this isn't my project so I don't know it by heart or anything =)
linear() is used several times, but you'll notice that it's almost always in a "with variable_scope.variable_scope()" which makes it unique. If you don't do something similar with your matrix, that might explain your problem.
Thanks a lot, I have solved my problem. I found that I changed the i value in 'attention.py' by mistake, so that it did not run with variable_scope.variable_scope(variable_scope.get_variable_scope(), reuse=True)
.
Glad to hear you got it working!