nssharmaofficial commited on
Commit
dc4fff3
1 Parent(s): 58b663c

Remove eos in sentence

Browse files
Files changed (1) hide show
  1. source/predict_sample.py +2 -2
source/predict_sample.py CHANGED
@@ -73,12 +73,12 @@ def generate_caption(image: torch.Tensor,
73
 
74
  # id --> word
75
  next_word_pred = vocab.index_to_word(int(next_id_pred.item()))
76
- sentence.append(next_word_pred)
77
 
78
- # stop if we predict '<eos>'
79
  if next_word_pred == vocab.index2word[vocab.EOS]:
80
  break
81
 
 
 
82
  return sentence
83
 
84
 
 
73
 
74
  # id --> word
75
  next_word_pred = vocab.index_to_word(int(next_id_pred.item()))
 
76
 
 
77
  if next_word_pred == vocab.index2word[vocab.EOS]:
78
  break
79
 
80
+ sentence.append(next_word_pred)
81
+
82
  return sentence
83
 
84