a-PyTorch-Tutorial-to-Image-Captioning
a-PyTorch-Tutorial-to-Image-Captioning copied to clipboard
ValueError: max() arg is an empty sequence
I encounter with a bug which is "ValueError: max() arg is an empty sequence" when I run caption.py. I find that the parameter complete_inds and complete_seqs_scores is null during the process. Is this due to my checkpoint model? Could anyone help me? Thanks!!!
Well, it's empty, so there are no complete sequences. You could catch it with an if to add the last incomplete sequence:
if len(complete_seqs) == 0:
complete_seqs.extend(seqs.tolist()) # (s, step+1)
complete_seqs_alpha.extend(seqs_alpha.tolist())
complete_seqs_scores.extend(top_k_scores.tolist()) # (s)
That did it for me
Thank u so much! It works! Wish u have a nice day!
Well, it's empty, so there are no complete sequences. You could catch it with an if to add the last incomplete sequence:
if len(complete_seqs) == 0: complete_seqs.extend(seqs.tolist()) # (s, step+1) complete_seqs_alpha.extend(seqs_alpha.tolist()) complete_seqs_scores.extend(top_k_scores.tolist()) # (s)
That did it for me
I also,but not solve it