nouhadziri / THRED

The implementation of the paper "Augmenting Neural Response Generation with Context-Aware Topical Attention"
https://arxiv.org/abs/1811.01063
MIT License
111 stars 25 forks source link

A dimension problem random300 embedding at models/base.py. #23

Closed LTlitong closed 4 years ago

LTlitong commented 4 years ago

When I use random300 embedding to train, it report an dimension error during the concat operation at models/base.py. And I find that tensor "const_embedding_matrix“ is empty.

It traceback:

File "/1THRED/thred/main.py", line 45, in main model.train() File "/1THRED/thred/models/hierarchical_base.py", line 35, in train train_model = _helper.create_train_model(self.config, scope) File "/1THRED/thred/models/thred/thred_helper.py", line 45, in create_train_model scope=scope) File "/1THRED/thred/models/thred/thred_model.py", line 43, in init self.init_embeddings(params.vocab_file, params.vocab_pkl, scope=scope) File "/1THRED/thred/models/base.py", line 40, in init_embeddings self.embeddings = tf.concat([reserved_token_embeddings, trainable_embeddings, const_embedding_matrix], 0) File "/usr/local/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 1124, in concat return gen_array_ops.concat_v2(values=values, axis=axis, name=name) File "/usr/local/lib/python3.6/site-packages/tensorflow/python/ops/gen_array_ops.py", line 1033, in concat_v2 "ConcatV2", values=values, axis=axis, name=name) File "/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "/usr/local/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 488, in new_func return func(*args, **kwargs) File "/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3274, in create_op op_def=op_def) File "/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1792, in init control_input_ops) File "/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1631, in _create_c_op raise ValueError(str(e))

ValueError: Shape must be rank 2 but is rank 1 for 'thred_graph/embeddings/concat' (op: 'ConcatV2') with input shapes: [4,300], [40174,300], [0], [].

ehsk commented 4 years ago

Thanks for raising the issue! It should be fixed. Please test and let us know if you ran into other problems.

ehsk commented 4 years ago

Feel free to re-open it if the problem still exists.