Skip to content

Commit

Permalink
Add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
as-suvorov committed Mar 18, 2024
1 parent 019a92c commit 09692c8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions text_generation/causal_lm/cpp/group_beam_searcher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ struct Group {
void finish(Beam&& beam, const Parameters& parameters) {
beam.score /= std::pow(float(beam.tokens.size()), parameters.length_penalty);

// HF implementation counts eos_token for length penalty calculation
if (beam.tokens.back() == parameters.eos_token) {
beam.tokens.pop_back();
}
Expand Down

0 comments on commit 09692c8

Please sign in to comment.