fix: properly applying `total_score` to the final node

#2
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -396,7 +396,7 @@ def generate_beams(n_beams, start_sentence, scores, length_penalty, decoded_sequ
396
  children={},
397
  current_sequence=current_sequence,
398
  cumulative_score=cumulative_score,
399
- total_score=cumulative_score / (step + 1 ** length_penalty),
400
  children_score_divider=((step + 2) ** length_penalty),
401
  is_final=is_final,
402
  is_selected_sequence=(
 
396
  children={},
397
  current_sequence=current_sequence,
398
  cumulative_score=cumulative_score,
399
+ total_score=cumulative_score / ((step + 1) ** length_penalty),
400
  children_score_divider=((step + 2) ** length_penalty),
401
  is_final=is_final,
402
  is_selected_sequence=(