Closed seangtkelley closed 4 years ago
Training shapes:
squeeze tf.shape Tensor("query_encoder/rnn_encoder/Shape_2:0", shape=(?,), dtype=int32)
squeeze get_shape <bound method Tensor.get_shape of <tf.Tensor 'query_encoder/rnn_encoder/Squeeze_1:0' shape=<unknown> dtype=float32>>
max pool tf.shape Tensor("query_encoder/rnn_encoder/Shape_3:0", shape=(2,), dtype=int32)
max pool get_shape <bound method Tensor.get_shape of <tf.Tensor 'query_encoder/rnn_encoder/Max:0' shape=(?, 128) dtype=float32>>
mean pool tf.shape: Tensor("query_encoder/rnn_encoder/Shape_4:0", shape=(2,), dtype=int32)
mean pool get_shape: <bound method Tensor.get_shape of <tf.Tensor 'query_encoder/rnn_encoder/truediv:0' shape=(?, 128) dtype=float32>>
Prediction shapes:
squeeze tf.shape Tensor("query_encoder/rnn_encoder/Shape_2:0", shape=(?,), dtype=int32)
squeeze get_shape <bound method Tensor.get_shape of <tf.Tensor 'query_encoder/rnn_encoder/Squeeze_1:0' shape=<unknown> dtype=float32>>
max pool tf.shape Tensor("query_encoder/rnn_encoder/Shape_3:0", shape=(2,), dtype=int32)
max pool get_shape <bound method Tensor.get_shape of <tf.Tensor 'query_encoder/rnn_encoder/Max:0' shape=(?, 42) dtype=float32>>
mean pool tf.shape: Tensor("query_encoder/rnn_encoder/Shape_4:0", shape=(2,), dtype=int32)
mean pool get_shape: <bound method Tensor.get_shape of <tf.Tensor 'query_encoder/rnn_encoder/truediv:0' shape=(?, 42) dtype=float32>>
These six lines print out seven times for training and prediction.
It has now morphed into this error:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py", line 558, in set_shape
unknown_shape)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Shapes must be equal rank, but are 2 and 3
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/gradients_impl.py", line 841, in _GradientsHelper
in_grad.set_shape(t_in.get_shape())
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py", line 561, in set_shape
raise ValueError(str(e))
wandb: Waiting for W&B process to finish, PID 109
ValueError: Shapes must be equal rank, but are 2 and 3
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "train.py", line 191, in <module>
run_and_debug(lambda: run(args), args['--debug'])
File "/usr/local/lib/python3.6/dist-packages/dpu_utils/utils/debughelper.py", line 21, in run_and_debug
func()
File "train.py", line 191, in <lambda>
run_and_debug(lambda: run(args), args['--debug'])
File "train.py", line 177, in run
parallelize=not(arguments['--sequential']))
File "train.py", line 72, in run_train
model.make_model(is_train=True)
File "/home/dev/src/models/model.py", line 234, in make_model
self._make_training_step()
File "/home/dev/src/models/model.py", line 378, in _make_training_step
gradients = tf.gradients(self.ops['loss'], trainable_vars)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/gradients_impl.py", line 630, in gradients
gate_gradients, aggregation_method, stop_gradients)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/gradients_impl.py", line 848, in _GradientsHelper
(op.name, i, t_in.shape, in_grad.shape))
ValueError: Incompatible shapes between op input and calculated input gradient. Forward operation: query_encoder/nbow_encoder/cond/Merge. Input index: 1. Original input shape: (1, ?, 128). Calculated input gradient shape: (?, ?)
Run command
python predict.py -m ../resources/saved_models/rnn-2019-11-01-00-49-59_model_best.pkl.gz
Eventually, you will get the following error: