Don't print zeros/NaNs when no count histogram has been collected
This commit is contained in:
parent
e51ce72e03
commit
c5959d53ff
1 changed files with 12 additions and 6 deletions
18
llama.cpp
18
llama.cpp
|
@ -2248,12 +2248,16 @@ static void llama_model_quantize_internal(const std::string & fname_inp, const s
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("size = %8.2f MB -> %8.2f MB | hist: ", tensor.size/1024.0/1024.0, new_size/1024.0/1024.0);
|
printf("size = %8.2f MB -> %8.2f MB | hist: ", tensor.size/1024.0/1024.0, new_size/1024.0/1024.0);
|
||||||
|
int64_t tot_count = 0;
|
||||||
for (size_t i = 0; i < hist_cur.size(); i++) {
|
for (size_t i = 0; i < hist_cur.size(); i++) {
|
||||||
hist_all[i] += hist_cur[i];
|
hist_all[i] += hist_cur[i];
|
||||||
|
tot_count += hist_cur[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < hist_cur.size(); i++) {
|
if (tot_count > 0) {
|
||||||
printf("%5.3f ", hist_cur[i] / float(nelements));
|
for (size_t i = 0; i < hist_cur.size(); i++) {
|
||||||
|
printf("%5.3f ", hist_cur[i] / float(nelements));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
@ -2271,11 +2275,13 @@ static void llama_model_quantize_internal(const std::string & fname_inp, const s
|
||||||
sum_all += hist_all[i];
|
sum_all += hist_all[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("%s: hist: ", __func__);
|
if (sum_all > 0) {
|
||||||
for (size_t i = 0; i < hist_all.size(); i++) {
|
printf("%s: hist: ", __func__);
|
||||||
printf("%5.3f ", hist_all[i] / float(sum_all));
|
for (size_t i = 0; i < hist_all.size(); i++) {
|
||||||
|
printf("%5.3f ", hist_all[i] / float(sum_all));
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
}
|
}
|
||||||
printf("\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue