Skip to content

Commit bdade9b

Browse files
committed
ensure scale before rep pen
1 parent 076e61e commit bdade9b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

otherarch/utils.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -398,9 +398,9 @@ int32_t kcpp_quick_sample(float * logits, const int n_logits, const std::vector<
398398
if (rep_pen>1.0f && std::find(last_n_tokens.begin(), last_n_tokens.end(), i) != last_n_tokens.end()) {
399399
// if score < 0 then repetition penalty has to multiplied to reduce the previous token probability
400400
if (logits[i] < 0.0f) {
401-
logits_id.push_back(std::make_pair(logits[i]*scale*rep_pen, i));
401+
logits_id.push_back(std::make_pair((logits[i]*scale)*rep_pen, i));
402402
} else {
403-
logits_id.push_back(std::make_pair(logits[i]*scale/rep_pen, i));
403+
logits_id.push_back(std::make_pair((logits[i]*scale)/rep_pen, i));
404404
}
405405
} else {
406406
logits_id.push_back(std::make_pair(logits[i]*scale, i));

0 commit comments

Comments
 (0)