nmt
nmt copied to clipboard
Error when building BasicDecoder
I am trying to build a pretty simple seq2seq model and I keep getting weird error even though I am following tutorial.
I keep getting ValueError at the decoding stage
ValueError: Could not flatten dictionary. Key had 2 elements, but value had 1 elements. Key: [<tf.Tensor 'decoding/decoder/transpose:0' shape=(70, ?, 128) dtype=float32>, <tf.Tensor 'decoding/decoder/transpose_1:0' shape=(70, ?) dtype=int32>]
Here is my decoder code:
batch_size=70
nodes=128
lstm_dec = tf.contrib.rnn.LSTMCell(nodes)
helper = tf.contrib.seq2seq.TrainingHelper(
output_embed, output_len, time_major=False, name = "trainHelper"
)
projection_layer = tf.layers.Dense(DICTIONARY_SIZE, name="projection_layer")
# Decoder
decoder = tf.contrib.seq2seq.BasicDecoder(
lstm_dec,
helper,
last_state
)
# Dynamic decoding
outputs, _, _ = tf.contrib.seq2seq.dynamic_decode(decoder)
logits = projection_layer(outputs.rnn_output)
Sadly I couldn't find any explanation for that issue.
The only difference I see is that I am using time_major=False and I tried with time-major data but I got similar error
@Zakkery were you able to solve this? I am facing a similar issue