peter6888 / nlp_project

The final project for CS224n
0 stars 1 forks source link

InvalidArgumentError (see above for traceback): Incompatible shapes: [16,50000] vs. [16,400] #14

Open peter6888 opened 6 years ago

peter6888 commented 6 years ago
2018-03-10 01:13:05.554114: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
INFO:tensorflow:Starting standard services.
INFO:tensorflow:Saving checkpoint to path log/dr_debug/train/model.ckpt
INFO:tensorflow:Starting queue runners.
INFO:tensorflow:global_step/sec: 0
INFO:tensorflow:Created session.
INFO:tensorflow:starting run_training
INFO:tensorflow:running training step...
Traceback (most recent call last):
  File "/Users/peli/anaconda3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1323, in _do_call
    return fn(*args)
  File "/Users/peli/anaconda3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1302, in _run_fn
    status, run_metadata)
  File "/Users/peli/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/errors_impl.py", line 473, in __exit__
    c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: Incompatible shapes: [16,50000] vs. [16,400]
     [[Node: gradients/seq2seq/output_projection_paulus/mul_grad/BroadcastGradientArgs = BroadcastGradientArgs[T=DT_INT32, _device="/job:localhost/replica:0/task:0/device:CPU:0"](gradients/seq2seq/output_projection_paulus/mul_198_grad/Shape, gradients/seq2seq/final_distribution/mul_100_grad/Shape_1)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "run_summarization.py", line 347, in <module>
    tf.app.run()
  File "/Users/peli/anaconda3/lib/python3.5/site-packages/tensorflow/python/platform/app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "run_summarization.py", line 331, in main
    setup_training(model, batcher)
  File "run_summarization.py", line 192, in setup_training
    summary_writer)  # this is an infinite loop until interrupted
  File "run_summarization.py", line 210, in run_training
    results = model.run_train_step(sess, batch)
  File "/Users/peli/forgit/nlp_project/src/model.py", line 459, in run_train_step

  File "/Users/peli/anaconda3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 889, in run
    run_metadata_ptr)
  File "/Users/peli/anaconda3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1120, in _run
    feed_dict_tensor, options, run_metadata)
  File "/Users/peli/anaconda3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1317, in _do_run
    options, run_metadata)
  File "/Users/peli/anaconda3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1336, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Incompatible shapes: [16,50000] vs. [16,400]
     [[Node: gradients/seq2seq/output_projection_paulus/mul_grad/BroadcastGradientArgs = BroadcastGradientArgs[T=DT_INT32, _device="/job:localhost/replica:0/task:0/device:CPU:0"](gradients/seq2seq/output_projection_paulus/mul_198_grad/Shape, gradients/seq2seq/final_distribution/mul_100_grad/Shape_1)]]

Caused by op 'gradients/seq2seq/output_projection_paulus/mul_grad/BroadcastGradientArgs', defined at:
  File "run_summarization.py", line 347, in <module>
    tf.app.run()
  File "/Users/peli/anaconda3/lib/python3.5/site-packages/tensorflow/python/platform/app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "run_summarization.py", line 331, in main
    setup_training(model, batcher)
  File "run_summarization.py", line 171, in setup_training
    model.build_graph()  # build the graph
  File "/Users/peli/forgit/nlp_project/src/model.py", line 443, in build_graph
    self._summaries = tf.summary.merge_all()
  File "/Users/peli/forgit/nlp_project/src/model.py", line 419, in _add_train_op
  File "/Users/peli/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/gradients_impl.py", line 581, in gradients
    grad_scope, op, func_call, lambda: grad_fn(op, *out_grads))
  File "/Users/peli/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/gradients_impl.py", line 353, in _MaybeCompile
    return grad_fn()  # Exit early
  File "/Users/peli/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/gradients_impl.py", line 581, in <lambda>
    grad_scope, op, func_call, lambda: grad_fn(op, *out_grads))
  File "/Users/peli/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/math_grad.py", line 742, in _MulGrad
    rx, ry = gen_array_ops._broadcast_gradient_args(sx, sy)
  File "/Users/peli/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/gen_array_ops.py", line 532, in _broadcast_gradient_args
    "BroadcastGradientArgs", s0=s0, s1=s1, name=name)
  File "/Users/peli/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
    op_def=op_def)
  File "/Users/peli/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 2956, in create_op
    op_def=op_def)
  File "/Users/peli/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1470, in __init__
    self._traceback = self._graph._extract_stack()  # pylint: disable=protected-access

...which was originally created as op 'seq2seq/output_projection_paulus/mul', defined at:
  File "run_summarization.py", line 347, in <module>
    tf.app.run()
[elided 2 identical lines from previous traceback]
  File "run_summarization.py", line 171, in setup_training
    model.build_graph()  # build the graph
  File "/Users/peli/forgit/nlp_project/src/model.py", line 440, in build_graph
    self.global_step = tf.Variable(0, name='global_step', trainable=False)
  File "/Users/peli/forgit/nlp_project/src/model.py", line 289, in _add_seq2seq
    vocab_dists, vocab_scores = self.caculate_baseline_dist(params)
  File "/Users/peli/forgit/nlp_project/src/model.py", line 373, in _calc_baseline_dists_paulus
    vocab_dist, vocab_score = tokenization(tokenization_params)
  File "/Users/peli/forgit/nlp_project/src/token_generation_and_pointer.py", line 91, in tokenization
    vocab_dists = tf.add(pointer * copy_distrubution, (1 - pointer) * vocab_distribution)
  File "/Users/peli/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/math_ops.py", line 894, in binary_op_wrapper
    return func(x, y, name=name)
  File "/Users/peli/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/math_ops.py", line 1117, in _mul_dispatch
    return gen_math_ops._mul(x, y, name=name)
  File "/Users/peli/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/gen_math_ops.py", line 2726, in _mul
    "Mul", x=x, y=y, name=name)
  File "/Users/peli/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
    op_def=op_def)

InvalidArgumentError (see above for traceback): Incompatible shapes: [16,50000] vs. [16,400]
     [[Node: gradients/seq2seq/output_projection_paulus/mul_grad/BroadcastGradientArgs = BroadcastGradientArgs[T=DT_INT32, _device="/job:localhost/replica:0/task:0/device:CPU:0"](gradients/seq2seq/output_projection_paulus/mul_198_grad/Shape, gradients/seq2seq/final_distribution/mul_100_grad/Shape_1)]]

Peters-MacBook-Pro:src peli$ 
peter6888 commented 6 years ago

still need to figure out how to fix below issue

INFO:tensorflow:Adding attention_decoder timestep 98 of 100
INFO:tensorflow:Adding attention_decoder timestep 99 of 100
Traceback (most recent call last):
  File "/Users/peli/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/common_shapes.py", line 686, in _call_cpp_shape_fn_impl
    input_tensors_as_shapes, status)
  File "/Users/peli/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/errors_impl.py", line 473, in __exit__
    c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: Dimensions must be equal, but are 400 and 50000 for 'seq2seq/output_projection_paulus/mul_1' (op: 'Mul') with input shapes: [16,400], [16,50000].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "run_summarization.py", line 347, in <module>
    tf.app.run()
  File "/Users/peli/anaconda3/lib/python3.5/site-packages/tensorflow/python/platform/app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "run_summarization.py", line 331, in main
    setup_training(model, batcher)
  File "run_summarization.py", line 171, in setup_training
    model.build_graph()  # build the graph
  File "/Users/peli/forgit/nlp_project/src/model.py", line 440, in build_graph
    self._add_seq2seq()
  File "/Users/peli/forgit/nlp_project/src/model.py", line 289, in _add_seq2seq
    vocab_dists, vocab_scores = self.caculate_baseline_dist(params)
  File "/Users/peli/forgit/nlp_project/src/model.py", line 374, in _calc_baseline_dists_paulus
    vocab_dist, vocab_score = tokenization(tokenization_params)
  File "/Users/peli/forgit/nlp_project/src/token_generation_and_pointer.py", line 91, in tokenization
    vocab_dists = tf.add(pointer * copy_distrubution, (1 - pointer) * vocab_distribution)
  File "/Users/peli/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/math_ops.py", line 894, in binary_op_wrapper
    return func(x, y, name=name)
  File "/Users/peli/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/math_ops.py", line 1117, in _mul_dispatch
    return gen_math_ops._mul(x, y, name=name)
  File "/Users/peli/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/gen_math_ops.py", line 2726, in _mul
    "Mul", x=x, y=y, name=name)
  File "/Users/peli/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
    op_def=op_def)
  File "/Users/peli/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 2958, in create_op
    set_shapes_for_outputs(ret)
  File "/Users/peli/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 2209, in set_shapes_for_outputs
    shapes = shape_func(op)
  File "/Users/peli/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 2159, in call_with_requiring
    return call_cpp_shape_fn(op, require_shape_fn=True)
  File "/Users/peli/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/common_shapes.py", line 627, in call_cpp_shape_fn
    require_shape_fn)
  File "/Users/peli/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/common_shapes.py", line 691, in _call_cpp_shape_fn_impl
    raise ValueError(err.message)
ValueError: Dimensions must be equal, but are 400 and 50000 for 'seq2seq/output_projection_paulus/mul_1' (op: 'Mul') with input shapes: [16,400], [16,50000].
Peters-MacBook-Pro:src peli$