Skip to content

Commit

Permalink
ensure scale before rep pen
Browse files Browse the repository at this point in the history
  • Loading branch information
LostRuins committed Feb 9, 2025
1 parent 076e61e commit bdade9b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions otherarch/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,9 +398,9 @@ int32_t kcpp_quick_sample(float * logits, const int n_logits, const std::vector<
if (rep_pen>1.0f && std::find(last_n_tokens.begin(), last_n_tokens.end(), i) != last_n_tokens.end()) {
// if score < 0 then repetition penalty has to multiplied to reduce the previous token probability
if (logits[i] < 0.0f) {
logits_id.push_back(std::make_pair(logits[i]*scale*rep_pen, i));
logits_id.push_back(std::make_pair((logits[i]*scale)*rep_pen, i));
} else {
logits_id.push_back(std::make_pair(logits[i]*scale/rep_pen, i));
logits_id.push_back(std::make_pair((logits[i]*scale)/rep_pen, i));
}
} else {
logits_id.push_back(std::make_pair(logits[i]*scale, i));
Expand Down

0 comments on commit bdade9b

Please sign in to comment.