From bdade9be1b0aa946a0c11b2f3e1499f63b5f0e05 Mon Sep 17 00:00:00 2001 From: Concedo <39025047+LostRuins@users.noreply.github.com> Date: Sun, 9 Feb 2025 16:59:56 +0800 Subject: [PATCH] ensure scale before rep pen --- otherarch/utils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/otherarch/utils.cpp b/otherarch/utils.cpp index 410e7bb13..29f9e698f 100644 --- a/otherarch/utils.cpp +++ b/otherarch/utils.cpp @@ -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));