Skip to content

Commit 13e08d0

Browse files
committed
Sync latest changes
1 parent 8a569cf commit 13e08d0

File tree

2 files changed

+258
-54
lines changed

2 files changed

+258
-54
lines changed

examples/perplexity/perplexity.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ static results_perplexity perplexity(llama_context * ctx, const gpt_params & par
397397
}
398398
);
399399
const size_t num_prune = std::min(pass_results.size(), prune_target);
400+
if (num_prune > 0) printf("\nPruning: ");
400401
for (size_t temp = 0, pruned = 0; temp < pass_results.size(); temp++) {
401402
int32_t lidx = std::get<0>(pass_results[temp]);
402403
if (anti_mode) {
@@ -405,17 +406,17 @@ static results_perplexity perplexity(llama_context * ctx, const gpt_params & par
405406
}
406407
if (lidx == curr_best_layer && std::get<1>(pass_results[temp]) == curr_best_type) continue;
407408
extremes[lidx] |= std::get<1>(pass_results[temp]);
408-
printf("\nPrune[%zu]: %d (%d) - %.2f\n", pruned + 1, lidx,
409+
printf("[%zu: %d (%d) - %.2f], ", pruned + 1, lidx,
409410
std::get<1>(pass_results[temp]), std::get<2>(pass_results[temp]));
410411
if (++pruned >= num_prune) break;
411412
}
412413
}
413414
pass_results.clear();
414-
printf("\n\nADD %c%3d - ppl vs ref %.4f",
415+
printf("\n\nADD %c%3d - ppl vs ref %.4f - cur:[",
415416
int(label[curr_best_type]), curr_best_layer,
416417
curr_best_ppl - ref_ppl);
417418
if (!anti_mode) {
418-
if (curr_best_ppl > ref_ppl * 1.75) break;
419+
// if (curr_best_ppl > ref_ppl * 1.75) break;
419420
skip_types[curr_best_layer] += curr_best_type;
420421
skips.push_back(curr_best_type == 1 ? curr_best_layer : curr_best_layer + n_layers);
421422
}
@@ -426,6 +427,10 @@ static results_perplexity perplexity(llama_context * ctx, const gpt_params & par
426427
for (int32_t new_sl = 0; new_sl < n_layers; new_sl++) {
427428
skip_types[new_sl] = (skip_types[new_sl] & 3) | (extremes[new_sl] << 2);
428429
}
430+
for (int32_t i = 0; i < n_layers; i++) {
431+
const int val = mask ^ (skip_types[i] & 3);
432+
printf("%d%s", val, i < n_layers - 1 ? ", " : "]");
433+
}
429434
for (int32_t new_sl = 0; new_sl < n_layers; new_sl++) {
430435
int32_t curr_skipped = (skip_types[new_sl] >> 2) | (skip_types[new_sl] & 3);
431436
// printf("||%d, %d\n", new_sl, curr_skipped);

0 commit comments

Comments
 (0)