Skip to content

Commit 6664d47

Browse files
committed
cleanup pr and remove explicit floats
1 parent f08e6f5 commit 6664d47

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/llama-sampling.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1657,7 +1657,6 @@ struct llama_sampler_top_n_sigma {
16571657
static const char * llama_sampler_top_n_sigma_name(const struct llama_sampler * /*smpl*/) {
16581658
return "top-n-sigma";
16591659
}
1660-
#include <iostream>
16611660

16621661
static void llama_sampler_top_n_sigma_apply(struct llama_sampler * smpl, llama_token_data_array * cur_p) {
16631662
const auto * ctx = (llama_sampler_top_n_sigma *) smpl->ctx;
@@ -1671,18 +1670,18 @@ static void llama_sampler_top_n_sigma_apply(struct llama_sampler * smpl, llama_t
16711670
}
16721671
logits_sum += cur_p->data[i].logit;
16731672
}
1674-
float mean = (float)logits_sum/cur_p->size;
1673+
float mean = logits_sum/cur_p->size;
16751674

16761675
// calculate standard deviation
16771676
float acc = 0;
16781677
for(size_t i = 0; i < cur_p->size; ++i){
16791678
acc += pow(cur_p->data[i].logit - mean, 2);
16801679
}
1681-
float std = sqrt((float)acc/cur_p->size);
1680+
float std = sqrt(acc/cur_p->size);
16821681

16831682
//apply mask
16841683
for(size_t i = 0; i < cur_p->size; ++i){
1685-
if(cur_p->data[i].logit < max - ((float)ctx->n * std)) {
1684+
if(cur_p->data[i].logit < max - ctx->n * std) {
16861685
cur_p->data[i].logit = -INFINITY;
16871686
}
16881687
}

0 commit comments

Comments
 (0)