From 36103411f350c43fe15f54627cd7dab46a57889a Mon Sep 17 00:00:00 2001 From: l3utterfly Date: Wed, 24 Jan 2024 09:05:51 +0900 Subject: [PATCH] reformat 't' case in llama_sample_queue Co-authored-by: Jared Van Bortel --- common/sampling.cpp | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/common/sampling.cpp b/common/sampling.cpp index 88b703127..27def158a 100644 --- a/common/sampling.cpp +++ b/common/sampling.cpp @@ -145,25 +145,15 @@ static void sampler_queue( case 'y': llama_sample_typical (ctx_main, &cur_p, typical_p, min_keep); break; case 'p': llama_sample_top_p (ctx_main, &cur_p, top_p, min_keep); break; case 'm': llama_sample_min_p (ctx_main, &cur_p, min_p, min_keep); break; - case 't': - if (dynatemp_range>0) - { - float dynatemp_min = temp - dynatemp_range; + if (dynatemp_range > 0) { + float dynatemp_min = std::max(0, temp - dynatemp_range); float dynatemp_max = temp + dynatemp_range; - //do not allow negative values - dynatemp_min = dynatemp_min<0?0:dynatemp_min; - dynatemp_max = dynatemp_max<0?0:dynatemp_max; - llama_sample_entropy(ctx_main, &cur_p, dynatemp_min, dynatemp_max, dynatemp_exponent); - } - else - { + } else { llama_sample_temp(ctx_main, &cur_p, temp); } - break; - default : break; } }