localminimum / R-net

A Tensorflow Implementation of R-net: Machine reading comprehension with self matching networks
MIT License
323 stars 122 forks source link

mode="demo" #30

Closed sshmyeclipse closed 6 years ago

sshmyeclipse commented 6 years ago

Run the local host for online demo... Tensor("passage_embeddings/embedding_lookup:0", shape=(1, 300, 300), dtype=float32, device=/device:CPU:0) Tensor("passage_char_encoding/Reshape_2:0", shape=(50, 300, 150), dtype=float32) Traceback (most recent call last): File "model.py", line 291, in model = Model(is_training = False, demo = True); print("Built model") File "model.py", line 70, in init self.encode_ids() File "model.py", line 116, in encode_ids self.passage_encoding = tf.concat((self.passage_word_encoded, self.passage_char_encoded),axis = 2) File "/home/summba/.conda/envs/tf12py27/lib/python2.7/site-packages/tensorflow/python/ops/array_ops.py", line 1048, in concat name=name) File "/home/summba/.conda/envs/tf12py27/lib/python2.7/site-packages/tensorflow/python/ops/gen_array_ops.py", line 495, in _concat_v2 name=name) File "/home/summba/.conda/envs/tf12py27/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 767, in apply_op op_def=op_def) File "/home/summba/.conda/envs/tf12py27/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2508, in create_op set_shapes_for_outputs(ret) File "/home/summba/.conda/envs/tf12py27/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1873, in set_shapes_for_outputs shapes = shape_func(op) File "/home/summba/.conda/envs/tf12py27/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1823, in call_with_requiring return call_cpp_shape_fn(op, require_shape_fn=True) File "/home/summba/.conda/envs/tf12py27/lib/python2.7/site-packages/tensorflow/python/framework/common_shapes.py", line 610, in call_cpp_shape_fn debug_python_shape_fn, require_shape_fn) File "/home/summba/.conda/envs/tf12py27/lib/python2.7/site-packages/tensorflow/python/framework/common_shapes.py", line 676, in _call_cpp_shape_fn_impl raise ValueError(err.message) ValueError: Dimension 0 in both shapes must be equal, but are 1 and 50 for 'concat' (op: 'ConcatV2') with input shapes: [1,300,300], [50,300,150], [] and with computed input tensors: input[2] = <2>.

ghost commented 6 years ago

Hi @sshmyeclipse, please change the batch size to 1 when running demo.

sshmyeclipse commented 6 years ago

Get it,thanks