ValueError: too many values to unpack (expected 2)
Author: maria22431
Pull request: no

hi
i tried run the code bi_LSTM for summerization but in Prediction got this  Error
i cheeked all thing but i didn't understand where the problem, here the Cod:
--------------------------------------------------------------------------------------
# Encode the input sequence to get the feature vector
encoder_model = Model(inputs=encoder_inputs,outputs=[encoder_inputs] + encoder_states1)

# Decoder setup
# Below tensors will hold the states of the previous time step
dec_h_state_f = tf.keras.layers.Input(shape=(latent_dim))
dec_h_state_r = tf.keras.layers.Input(shape=(latent_dim))

dec_c_state_f = tf.keras.layers.Input(shape=(latent_dim))
dec_c_state_r = tf.keras.layers.Input(shape=(latent_dim))

decoder_hidden_state_input = Input(shape=(max_text_len,latent_dim * 2))

# Get the embeddings of the decoder sequence
dec_emb2= dec_emb_layer(decoder_inputs) 
# To predict the next word in the sequence, set the initial states to the states from the previous time step
decoder_outputs2, decoder_fwd_state_h2, decoder_fwd_state_c2, decoder_back_state_h2, decoder_back_state_c2 =  decoder_lstm(
                                           dec_emb2, initial_state=[dec_h_state_f, dec_h_state_r, dec_c_state_f, dec_c_state_r])


#attention inference
attn_out_inf, attn_states_inf = attn_layer([decoder_hidden_state_input, decoder_outputs2])
decoder_inf_concat = Concatenate(axis=-1, name='concat')([decoder_outputs2, attn_out_inf])

# A dense softmax layer to generate prob dist. over the target vocabulary
decoder_outputs2 = decoder_dense(decoder_inf_concat) 

# Final decoder model
decoder_model = Model(
    [decoder_inputs] + [decoder_hidden_state_input]+ [dec_h_state_f, dec_h_state_r, dec_c_state_f, dec_c_state_r],
    [decoder_outputs2] + [decoder_fwd_state_h2, decoder_fwd_state_c2, decoder_back_state_h2, decoder_back_state_c2])
---------------------------------------------------------------------
def decode_sequence(input_seq):
    # Encode the input as state vectors.
    e_out, state_values = encoder_model.predict(input_seq)
    
    # Generate empty target sequence of length 1.
    target_seq = np.zeros((1,1))
    
    # Populate the first word of target sequence with the start word.
    target_seq[0, 0] = target_word_index['sostok']

    stop_condition = False
    decoded_sentence = ''
    while not stop_condition:
      
        output_tokens, decoder_states = decoder_model.predict([target_seq] + [e_out] + state_values)

        # Sample a token
        sampled_token_index = np.argmax(output_tokens[0, -1, :])
        sampled_token = reverse_target_word_index[sampled_token_index+1]
        
        if(sampled_token!='eostok'):
            decoded_sentence += ' '+sampled_token

        # Exit condition: either hit max length or find stop word.
        if (sampled_token == 'eostok'  or len(decoded_sentence.split()) >= (max_summary_len-1)):
            stop_condition = True

        # Update the target sequence (of length 1).
        target_seq = np.zeros((1,1))
        target_seq[0, 0] = sampled_token_index

        # Update internal states
        state_values = decoder_states

    return decoded_sentence
------------------------------------------
ValueError                                Traceback (most recent call last)

[<ipython-input-69-0e69bf8de83c>](https://localhost:8080/#) in <module>()
      2     print("Review:",seq2text(x_tr[i]))
      3     print("Original summary:",seq2summary(y_tr[i]))
----> 4     print("Predicted summary:",decode_sequence(x_tr[i].reshape(1,max_text_len)))
      5     print("\n")

[<ipython-input-67-d9c528c43f6a>](https://localhost:8080/#) in decode_sequence(input_seq)
      1 def decode_sequence(input_seq):
      2     # Encode the input as state vectors.
----> 3     e_out, state_values = encoder_model.predict(input_seq)
      4 
      5     # Generate empty target sequence of length 1.

**ValueError: too many values to unpack (expected 2)**
 

Comments:
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.