question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

list index out of range: `rev_dec_vocab[output] for output in outputs`

See original GitHub issue

While testing, I am encountering the following error:

Traceback (most recent call last):
  File "execute.py", line 294, in <module>
    decode()
  File "execute.py", line 227, in decode
    predicted_headline.write(" ".join([tf.compat.as_str(rev_dec_vocab[output]) for output in outputs])+'\n')
IndexError: list index out of range

My outputs list looks like this:

[38156, 38156, 38156, 38156, 14453, 14453, 8254, 25504, 25504, 27218, 25504, 8254, 8254, 8254, 8254, 8254, 8254, 27218, 10802, 27218]

And this the length of rev_dec_vocab is: 12695

This explains the error, but can you explain why am I facing this error? What do these variables signify? Also, the outputs list contains repeated elements. Is it okay or is there something wrong? Thanks!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14

github_iconTop GitHub Comments

1reaction
PR-Iyyercommented, Oct 26, 2017

at times, it wont work when the complete path is not given. Error says its still unable to find working_dir . I strongly recommend you to provide full path for seq2seq.ckpt-XXXX like have given in the code. Just try once and see. I feel it should work.

1reaction
PR-Iyyercommented, Oct 26, 2017

[strings]

Mode : train, test, interactive

mode = interactive pretrained_model=/data/praveena/Newfinal/deep-news-summarization/working_dir/seq2seq.ckpt-357000

Specify the training, evaluation and testing encode and decode dataset

path train_enc = dataset/train_enc.txt train_dec = dataset/train_dec.txt eval_enc = dataset/eval_enc.txt eval_dec = dataset/eval_dec.txt test_enc = dataset/test_enc.txt test_dec = dataset/test_dec.txt

folder where checkpoints and vocabulary will be stored

working_directory = working_dir/

path to store predicted output

output = output/predicted_test_headline.txt

[ints]

vocabulary size

typical options: 40000, 60000, 80000. The results showed in the repo use

a vocab size of 80000. enc_vocab_size = 40000 dec_vocab_size = 40000

number of LSTM layers : 1/2/3. The results showed in the repo use 3

layers. num_layers = 1

typical options : 128, 256, 512, 1024. The results showed in the repo use

512 hidden units. hidden_units = 128

dataset size limit; typically none : no limit

max_train_data_size = 0

Control batch size to decide when to update weights

batch_size = 128

steps per checkpoint

Note : At a checkpoint, models parameters are saved, model is evaluated

and results are printed

steps_per_checkpoint = 100

[floats] learning_rate = 0.5 learning_rate_decay_factor = 0.99 max_gradient_norm = 5.0 ##############################################################################

Note : Edit the bucket sizes at line47 of execute.py (_buckets)

Learn more about the configurations from this link

https://www.tensorflow.org/versions/r0.9/tutorials/seq2seq/index.html

##############################################################################

On Thu, Oct 26, 2017 at 3:56 PM, Gaurav Verma notifications@github.com wrote:

@PR-Iyyer https://github.com/pr-iyyer : That’s what I have been trying to do too. Can you share your seq2seq.ini with me here?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/hengluchang/deep-news-summarization/issues/1#issuecomment-339622376, or mute the thread https://github.com/notifications/unsubscribe-auth/AfD54ik2Uik4qzWazfpIYzuMMQALeq45ks5swF5egaJpZM4QBg5b .

– Regards, Praveena.R

Read more comments on GitHub >

github_iconTop Results From Across the Web

List Index Out of Range – Python Error Message Solved
In this article you'll see a few of the reasons that cause the list index out of range Python error. Besides knowing why...
Read more >
What Does the Python "List index out of range" Error Mean?
An index error stands between you and a fully functional program... what will you do?
Read more >
Indexerror: list Index Out of Range in Python - STechies
“List index out of range” error occurs in Python when we try to access an undefined element from the list. The only way...
Read more >
IndexError : list index out of range while looping - Stack Overflow
print(response.json()) gives :: status : code :10000 description : OK and prints the whole output . – IrateLeaf98. Jan 20, 2020 at 13:40....
Read more >
phobius: list index out of range · Issue #259 - GitHub
Hi there I am having some issue with an out of range error with the phobius output or during merging phobius/signalp outputs.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found