Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot run the program #13

Open
ccywch opened this issue Jun 10, 2017 · 3 comments
Open

Cannot run the program #13

ccywch opened this issue Jun 10, 2017 · 3 comments

Comments

@ccywch
Copy link

ccywch commented Jun 10, 2017

Thanks a lot for your implementation.
I tried to rerun your program to train my own data, but I failed with the error messages as below:

W tensorflow/core/framework/op_kernel.cc:975] Invalid argument: slice index 20 of dimension 1 out of bounds.
W tensorflow/core/framework/op_kernel.cc:975] Invalid argument: slice index 20 of dimension 1 out of bounds.
[[Node: scan/while/strided_slice_1 = StridedSlice[Index=DT_INT32, T=DT_FLOAT, begin_mask=1, ellipsis_mask=0, end_mask=1, new_axis_mask=0, shrink_axis_mask=2, _device="/job:localhost/replica:0/task:0/gpu:0"](scan/while/strided_slice_1/Enter, scan/while/strided_slice_1/stack, scan/while/strided_slice_1/stack_1, scan/while/strided_slice_1/stack_2)]]
W tensorflow/core/framework/op_kernel.cc:975] Invalid argument: slice index 20 of dimension 1 out of bounds.
[[Node: scan/while/strided_slice_1 = StridedSlice[Index=DT_INT32, T=DT_FLOAT, begin_mask=1, ellipsis_mask=0, end_mask=1, new_axis_mask=0, shrink_axis_mask=2, _device="/job:localhost/replica:0/task:0/gpu:0"](scan/while/strided_slice_1/Enter, scan/while/strided_slice_1/stack, scan/while/strided_slice_1/stack_1, scan/while/strided_slice_1/stack_2)]]
W tensorflow/core/framework/op_kernel.cc:975] Invalid argument: slice index 20 of dimension 1 out of bounds.
[[Node: scan/while/strided_slice_1 = StridedSlice[Index=DT_INT32, T=DT_FLOAT, begin_mask=1, ellipsis_mask=0, end_mask=1, new_axis_mask=0, shrink_axis_mask=2, _device="/job:localhost/replica:0/task:0/gpu:0"](scan/while/strided_slice_1/Enter, scan/while/strided_slice_1/stack, scan/while/strided_slice_1/stack_1, scan/while/strided_slice_1/stack_2)]]
W tensorflow/core/framework/op_kernel.cc:975] Invalid argument: slice index 20 of dimension 1 out of bounds.
[[Node: scan/while/strided_slice_1 = StridedSlice[Index=DT_INT32, T=DT_FLOAT, begin_mask=1, ellipsis_mask=0, end_mask=1, new_axis_mask=0, shrink_axis_mask=2, _device="/job:localhost/replica:0/task:0/gpu:0"](scan/while/strided_slice_1/Enter, scan/while/strided_slice_1/stack, scan/while/strided_slice_1/stack_1, scan/while/strided_slice_1/stack_2)]]
W tensorflow/core/framework/op_kernel.cc:975] Invalid argument: slice index 20 of dimension 1 out of bounds.
[[Node: scan/while/strided_slice_1 = StridedSlice[Index=DT_INT32, T=DT_FLOAT, begin_mask=1, ellipsis_mask=0, end_mask=1, new_axis_mask=0, shrink_axis_mask=2, _device="/job:localhost/replica:0/task:0/gpu:0"](scan/while/strided_slice_1/Enter, scan/while/strided_slice_1/stack, scan/while/strided_slice_1/stack_1, scan/while/strided_slice_1/stack_2)]]
W tensorflow/core/framework/op_kernel.cc:975] Invalid argument: slice index 20 of dimension 1 out of bounds.
[[Node: scan/while/strided_slice_1 = StridedSlice[Index=DT_INT32, T=DT_FLOAT, begin_mask=1, ellipsis_mask=0, end_mask=1, new_axis_mask=0, shrink_axis_mask=2, _device="/job:localhost/replica:0/task:0/gpu:0"](scan/while/strided_slice_1/Enter, scan/while/strided_slice_1/stack, scan/while/strided_slice_1/stack_1, scan/while/strided_slice_1/stack_2)]]
W tensorflow/core/framework/op_kernel.cc:975] Invalid argument: slice index 20 of dimension 1 out of bounds.
W tensorflow/core/framework/op_kernel.cc:975] Invalid argument: slice index 20 of dimension 1 out of bounds.
[[Node: scan/while/strided_slice_1 = StridedSlice[Index=DT_INT32, T=DT_FLOAT, begin_mask=1, ellipsis_mask=0, end_mask=1, new_axis_mask=0, shrink_axis_mask=2, _device="/job:localhost/replica:0/task:0/gpu:0"](scan/while/strided_slice_1/Enter, scan/while/strided_slice_1/stack, scan/while/strided_slice_1/stack_1, scan/while/strided_slice_1/stack_2)]]
W tensorflow/core/framework/op_kernel.cc:975] Invalid argument: slice index 20 of dimension 1 out of bounds.
[[Node: scan/while/strided_slice_1 = StridedSlice[Index=DT_INT32, T=DT_FLOAT, begin_mask=1, ellipsis_mask=0, end_mask=1, new_axis_mask=0, shrink_axis_mask=2, _device="/job:localhost/replica:0/task:0/gpu:0"](scan/while/strided_slice_1/Enter, scan/while/strided_slice_1/stack, scan/while/strided_slice_1/stack_1, scan/while/strided_slice_1/stack_2)]]
W tensorflow/core/framework/op_kernel.cc:975] Invalid argument: slice index 20 of dimension 1 out of bounds.
[[Node: scan/while/strided_slice_1 = StridedSlice[Index=DT_INT32, T=DT_FLOAT, begin_mask=1, ellipsis_mask=0, end_mask=1, new_axis_mask=0, shrink_axis_mask=2, _device="/job:localhost/replica:0/task:0/gpu:0"](scan/while/strided_slice_1/Enter, scan/while/strided_slice_1/stack, scan/while/strided_slice_1/stack_1, scan/while/strided_slice_1/stack_2)]]
W tensorflow/core/framework/op_kernel.cc:975] Invalid argument: slice index 20 of dimension 1 out of bounds.
[[Node: scan/while/strided_slice_1 = StridedSlice[Index=DT_INT32, T=DT_FLOAT, begin_mask=1, ellipsis_mask=0, end_mask=1, new_axis_mask=0, shrink_axis_mask=2, _device="/job:localhost/replica:0/task:0/gpu:0"](scan/while/strided_slice_1/Enter, scan/while/strided_slice_1/stack, scan/while/strided_slice_1/stack_1, scan/while/strided_slice_1/stack_2)]]
W tensorflow/core/framework/op_kernel.cc:975] Invalid argument: slice index 20 of dimension 1 out of bounds.
[[Node: scan/while/strided_slice_1 = StridedSlice[Index=DT_INT32, T=DT_FLOAT, begin_mask=1, ellipsis_mask=0, end_mask=1, new_axis_mask=0, shrink_axis_mask=2, device="/job:localhost/replica:0/task:0/gpu:0"](scan/while/strided_slice_1/Enter, scan/while/strided_slice_1/stack, scan/while/strided_slice_1/stack_1, scan/while/strided_slice_1/stack_2)]]
I tensorflow/core/common_runtime/gpu/pool_allocator.cc:247] PoolAllocator: After 17466 get requests, put_count=7522 evicted_count=1000 eviction_rate=0.132943 and unsatisfied allocation rate=0.632314
I tensorflow/core/common_runtime/gpu/pool_allocator.cc:259] Raising pool_size_limit
from 100 to 110
Traceback (most recent call last):
File "attention.py", line 157, in
_ , _loss = sess.run([train_step,loss],feed_dict={X:train_img,seqs:train_seq,mask:train_mask,learn_rate:lr})
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 766, in run
run_metadata_ptr)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 964, in _run
feed_dict_string, options, run_metadata)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1014, in _do_run
target_list, options, run_metadata)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1034, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: slice index 20 of dimension 1 out of bounds.
[[Node: scan/while/strided_slice_1 = StridedSlice[Index=DT_INT32, T=DT_FLOAT, begin_mask=1, ellipsis_mask=0, end_mask=1, new_axis_mask=0, shrink_axis_mask=2, _device="/job:localhost/replica:0/task:0/gpu:0"](scan/while/strided_slice_1/Enter, scan/while/strided_slice_1/stack, scan/while/strided_slice_1/stack_1, scan/while/strided_slice_1/stack_2)]]
[[Node: gradients/scan/while/BiRNN/FW/FW/while/TensorArrayWriteV2_grad/TensorArrayReadV2/StackPush/_693 = _SendT=DT_FLOAT, client_terminated=false, recv_device="/job:localhost/replica:0/task:0/gpu:0", send_device="/job:localhost/replica:0/task:0/cpu:0", send_device_incarnation=1, tensor_name="edge_5093_gradients/scan/while/BiRNN/FW/FW/while/TensorArrayWriteV2_grad/TensorArrayReadV2/StackPush", _device="/job:localhost/replica:0/task:0/cpu:0"]]

Caused by op u'scan/while/strided_slice_1', defined at:
File "attention.py", line 37, in
out,state = tflib.ops.im2latexAttention('AttLSTM',emb_seqs,ctx,EMB_DIM,ENC_DIM,DEC_DIM,D,H,W)
File "/home/ccy/gui_learning/appUI/im2latex-tensorflow/tflib/ops.py", line 520, in im2latexAttention
V_cap = tf.scan(fn,tf.range(tf.shape(V)[1]), initializer=tf.placeholder(shape=(None,None,2*ENC_DIM),dtype=tf.float32))
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/functional_ops.py", line 585, in scan
back_prop=back_prop, swap_memory=swap_memory)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/control_flow_ops.py", line 2636, in while_loop
result = context.BuildLoop(cond, body, loop_vars, shape_invariants)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/control_flow_ops.py", line 2469, in BuildLoop
pred, body, original_loop_vars, loop_vars, shape_invariants)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/control_flow_ops.py", line 2419, in _BuildLoop
body_result = body(*packed_vars_for_body)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/functional_ops.py", line 575, in compute
a_out = fn(packed_a, packed_elems)
File "/home/ccy/gui_learning/appUI/im2latex-tensorflow/tflib/ops.py", line 518, in fn
return tflib.ops.BiLSTM(name+'.BiLSTMEncoder',V[:,i],D,ENC_DIM,h0_i_1[:,i],h0_i_2[:,i])
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 436, in _SliceHelper
name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 590, in strided_slice
shrink_axis_mask=shrink_axis_mask)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_array_ops.py", line 3503, in strided_slice
shrink_axis_mask=shrink_axis_mask, name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 759, in apply_op
op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2240, in create_op
original_op=self._default_original_op, op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 1128, in init
self._traceback = _extract_stack()

InvalidArgumentError (see above for traceback): slice index 20 of dimension 1 out of bounds.
[[Node: scan/while/strided_slice_1 = StridedSlice[Index=DT_INT32, T=DT_FLOAT, begin_mask=1, ellipsis_mask=0, end_mask=1, new_axis_mask=0, shrink_axis_mask=2, _device="/job:localhost/replica:0/task:0/gpu:0"](scan/while/strided_slice_1/Enter, scan/while/strided_slice_1/stack, scan/while/strided_slice_1/stack_1, scan/while/strided_slice_1/stack_2)]]
[[Node: gradients/scan/while/BiRNN/FW/FW/while/TensorArrayWriteV2_grad/TensorArrayReadV2/StackPush/_693 = _SendT=DT_FLOAT, client_terminated=false, recv_device="/job:localhost/replica:0/task:0/gpu:0", send_device="/job:localhost/replica:0/task:0/cpu:0", send_device_incarnation=1, tensor_name="edge_5093_gradients/scan/while/BiRNN/FW/FW/while/TensorArrayWriteV2_grad/TensorArrayReadV2/StackPush", _device="/job:localhost/replica:0/task:0/cpu:0"]]

Could you please help me solve this problem?
Thanks in advance.

@kalra333
Copy link

I am also getting the error , can someone please tell me how to resolve it

@ritheshkumar95
Copy link
Owner

Hi,

Sorry for the missing response in this thread.

I wrote this code when it was tensorflow version (0.9?), and didn't manage to get time with my busy schedule to rewrite my code with tf 1.0 (which is why you're not able to run it)

If someone else could do that and write a PR, i'm happy to review and merge it.

Best,
Rithesh

@VallesMarinerisExplorer
Copy link

So it should work well if I use TF 0.9? I have had other issues that I think are related to the tensorflow distribution as well. I am happy to help make an update to the current version of Tensorflow with some guidance as I am new to im2latex. I think this is a very useful and important project!

  • Alex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants