Hi,
I meet some problem in the inferece.py and don't know how to fix it. Could you look at it?
Traceback (most recent call last):
File "/home/yeliu/anaconda3/envs/TF12/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1334, in _do_call
return fn(*args)
File "/home/yeliu/anaconda3/envs/TF12/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1319, in _run_fn
options, feed_dict, fetch_list, target_list, run_metadata)
File "/home/yeliu/anaconda3/envs/TF12/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1407, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.InvalidArgumentError: input must have at least k columns. Had 3, needed 4
[[{{node TopKV2}} = TopKV2[T=DT_FLOAT, sorted=true, _device="/job:localhost/replica:0/task:0/device:GPU:0"](Reshape, _arg_Placeholder_4_0_4/_65)]]
[[{{node mod_3/_77}} = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_4336_mod_3", tensor_type=DT_INT32, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/yeliu/Project/CommonGen/neurips2019_intrus/notebooks/train_wmt_enru_1gpu.py", line 95, in
beam_size=4, beam_spread=10)
File "/home/yeliu/Project/CommonGen/neurips2019_intrus/lib/inference.py", line 102, in translate_line
sess.run([self.insert_kbest, self.finished_hypo_logprobs], feed)
File "/home/yeliu/anaconda3/envs/TF12/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 929, in run
run_metadata_ptr)
File "/home/yeliu/anaconda3/envs/TF12/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1152, in _run
feed_dict_tensor, options, run_metadata)
File "/home/yeliu/anaconda3/envs/TF12/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1328, in _do_run
run_metadata)
File "/home/yeliu/anaconda3/envs/TF12/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1348, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: input must have at least k columns. Had 3, needed 4
[[node TopKV2 (defined at /home/yeliu/Project/CommonGen/neurips2019_intrus/lib/inference.py:56) = TopKV2[T=DT_FLOAT, sorted=true, _device="/job:localhost/replica:0/task:0/device:GPU:0"](Reshape, _arg_Placeholder_4_0_4/_65)]]
[[{{node mod_3/_77}} = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_4336_mod_3", tensor_type=DT_INT32, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]
Caused by op 'TopKV2', defined at:
File "/home/yeliu/Project/CommonGen/neurips2019_intrus/notebooks/train_wmt_enru_1gpu.py", line 67, in
decoder = BeamSearchInserts(model)
File "/home/yeliu/Project/CommonGen/neurips2019_intrus/lib/inference.py", line 56, in init
best_inserts_flat = tf.nn.top_k(tf.reshape(hypo_logprobs_insert, [-1]), k=self.k_best, sorted=True)
File "/home/yeliu/anaconda3/envs/TF12/lib/python3.6/site-packages/tensorflow/python/ops/nn_ops.py", line 2359, in top_k
return gen_nn_ops.top_kv2(input, k=k, sorted=sorted, name=name)
File "/home/yeliu/anaconda3/envs/TF12/lib/python3.6/site-packages/tensorflow/python/ops/gen_nn_ops.py", line 7701, in top_kv2
"TopKV2", input=input, k=k, sorted=sorted, name=name)
File "/home/yeliu/anaconda3/envs/TF12/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/home/yeliu/anaconda3/envs/TF12/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 488, in new_func
return func(*args, **kwargs)
File "/home/yeliu/anaconda3/envs/TF12/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3274, in create_op
op_def=op_def)
File "/home/yeliu/anaconda3/envs/TF12/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1770, in init
self._traceback = tf_stack.extract_stack()
InvalidArgumentError (see above for traceback): input must have at least k columns. Had 3, needed 4
[[node TopKV2 (defined at /home/yeliu/Project/CommonGen/neurips2019_intrus/lib/inference.py:56) = TopKV2[T=DT_FLOAT, sorted=true, _device="/job:localhost/replica:0/task:0/device:GPU:0"](Reshape, _arg_Placeholder_4_0_4/_65)]]
[[{{node mod_3/_77}} = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_4336_mod_3", tensor_type=DT_INT32, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]
Hi, I meet some problem in the inferece.py and don't know how to fix it. Could you look at it? Traceback (most recent call last): File "/home/yeliu/anaconda3/envs/TF12/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1334, in _do_call return fn(*args) File "/home/yeliu/anaconda3/envs/TF12/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1319, in _run_fn options, feed_dict, fetch_list, target_list, run_metadata) File "/home/yeliu/anaconda3/envs/TF12/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1407, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.InvalidArgumentError: input must have at least k columns. Had 3, needed 4 [[{{node TopKV2}} = TopKV2[T=DT_FLOAT, sorted=true, _device="/job:localhost/replica:0/task:0/device:GPU:0"](Reshape, _arg_Placeholder_4_0_4/_65)]] [[{{node mod_3/_77}} = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_4336_mod_3", tensor_type=DT_INT32, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/yeliu/Project/CommonGen/neurips2019_intrus/notebooks/train_wmt_enru_1gpu.py", line 95, in
beam_size=4, beam_spread=10)
File "/home/yeliu/Project/CommonGen/neurips2019_intrus/lib/inference.py", line 102, in translate_line
sess.run([self.insert_kbest, self.finished_hypo_logprobs], feed)
File "/home/yeliu/anaconda3/envs/TF12/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 929, in run
run_metadata_ptr)
File "/home/yeliu/anaconda3/envs/TF12/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1152, in _run
feed_dict_tensor, options, run_metadata)
File "/home/yeliu/anaconda3/envs/TF12/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1328, in _do_run
run_metadata)
File "/home/yeliu/anaconda3/envs/TF12/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1348, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: input must have at least k columns. Had 3, needed 4
[[node TopKV2 (defined at /home/yeliu/Project/CommonGen/neurips2019_intrus/lib/inference.py:56) = TopKV2[T=DT_FLOAT, sorted=true, _device="/job:localhost/replica:0/task:0/device:GPU:0"](Reshape, _arg_Placeholder_4_0_4/_65)]]
[[{{node mod_3/_77}} = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_4336_mod_3", tensor_type=DT_INT32, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]
Caused by op 'TopKV2', defined at: File "/home/yeliu/Project/CommonGen/neurips2019_intrus/notebooks/train_wmt_enru_1gpu.py", line 67, in
decoder = BeamSearchInserts(model)
File "/home/yeliu/Project/CommonGen/neurips2019_intrus/lib/inference.py", line 56, in init
best_inserts_flat = tf.nn.top_k(tf.reshape(hypo_logprobs_insert, [-1]), k=self.k_best, sorted=True)
File "/home/yeliu/anaconda3/envs/TF12/lib/python3.6/site-packages/tensorflow/python/ops/nn_ops.py", line 2359, in top_k
return gen_nn_ops.top_kv2(input, k=k, sorted=sorted, name=name)
File "/home/yeliu/anaconda3/envs/TF12/lib/python3.6/site-packages/tensorflow/python/ops/gen_nn_ops.py", line 7701, in top_kv2
"TopKV2", input=input, k=k, sorted=sorted, name=name)
File "/home/yeliu/anaconda3/envs/TF12/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/home/yeliu/anaconda3/envs/TF12/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 488, in new_func
return func(*args, **kwargs)
File "/home/yeliu/anaconda3/envs/TF12/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3274, in create_op
op_def=op_def)
File "/home/yeliu/anaconda3/envs/TF12/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1770, in init
self._traceback = tf_stack.extract_stack()
InvalidArgumentError (see above for traceback): input must have at least k columns. Had 3, needed 4 [[node TopKV2 (defined at /home/yeliu/Project/CommonGen/neurips2019_intrus/lib/inference.py:56) = TopKV2[T=DT_FLOAT, sorted=true, _device="/job:localhost/replica:0/task:0/device:GPU:0"](Reshape, _arg_Placeholder_4_0_4/_65)]] [[{{node mod_3/_77}} = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_4336_mod_3", tensor_type=DT_INT32, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]