Skip to content

Commit 0d5f183

Browse files
committed
Refactor lagrange_penalty()
1 parent 9a1656e commit 0d5f183

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/llama-quant.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,21 +1288,21 @@ static std::unordered_map<std::string, ggml_type> target_bpw_type(
12881288
bytes = 0;
12891289
err = 0.0;
12901290
for (size_t i = 0; i < all.size(); ++i) {
1291-
const auto & cand = all[i].candidate;
1291+
const auto & candidate = all[i].candidate;
12921292
int best_j = 0;
12931293
double best_val = infinity;
1294-
for (int j = 0; j < (int)cand.size(); ++j) {
1295-
const double bits = (double)cand[j].bytes * 8.0;
1296-
const double val = cand[j].error + mu * bits;
1297-
if (val < best_val - epsilon || (std::abs(val - best_val) <= epsilon && cand[j].bytes < cand[best_j].bytes)) {
1294+
for (int j = 0; j < (int)candidate.size(); ++j) {
1295+
const double bits = (double)candidate[j].bytes * 8.0;
1296+
const double val = candidate[j].error + mu * bits;
1297+
if (val < best_val - epsilon || (std::abs(val - best_val) <= epsilon && candidate[j].bytes < candidate[best_j].bytes)) {
12981298
best_val = val;
12991299
best_j = j;
13001300
}
13011301
}
13021302

13031303
choice[i] = best_j;
1304-
bytes += cand[best_j].bytes;
1305-
err += cand[best_j].error;
1304+
bytes += candidate[best_j].bytes;
1305+
err += candidate[best_j].error;
13061306
}
13071307
};
13081308

0 commit comments

Comments
 (0)