@@ -176,28 +176,32 @@ struct common_sampler * common_sampler_init(const struct llama_model * model, co
176176 }
177177 break ;
178178 case COMMON_SAMPLER_TYPE_TOP_K:
179- llama_sampler_chain_add (result->chain , llama_sampler_init_top_k (params.top_k ));
179+ llama_sampler_chain_add (result->chain , llama_sampler_init_top_k (params.top_k ));
180180 break ;
181181 case COMMON_SAMPLER_TYPE_TOP_P:
182- llama_sampler_chain_add (result->chain , llama_sampler_init_top_p (params.top_p , params.min_keep ));
182+ llama_sampler_chain_add (result->chain , llama_sampler_init_top_p (params.top_p , params.min_keep ));
183183 break ;
184184 case COMMON_SAMPLER_TYPE_MIN_P:
185- llama_sampler_chain_add (result->chain , llama_sampler_init_min_p (params.min_p , params.min_keep ));
185+ llama_sampler_chain_add (result->chain , llama_sampler_init_min_p (params.min_p , params.min_keep ));
186186 break ;
187187 case COMMON_SAMPLER_TYPE_XTC:
188- llama_sampler_chain_add (result->chain , llama_sampler_init_xtc (params.xtc_probability , params.xtc_threshold , params.min_keep , params.seed ));
188+ llama_sampler_chain_add (result->chain , llama_sampler_init_xtc (params.xtc_probability , params.xtc_threshold , params.min_keep , params.seed ));
189189 break ;
190190 case COMMON_SAMPLER_TYPE_TYPICAL_P:
191- llama_sampler_chain_add (result->chain , llama_sampler_init_typical (params.typ_p , params.min_keep ));
191+ llama_sampler_chain_add (result->chain , llama_sampler_init_typical (params.typ_p , params.min_keep ));
192192 break ;
193193 case COMMON_SAMPLER_TYPE_TEMPERATURE:
194- llama_sampler_chain_add (result->chain , llama_sampler_init_temp_ext (params.temp , params.dynatemp_range , params.dynatemp_exponent ));
194+ llama_sampler_chain_add (result->chain , llama_sampler_init_temp_ext (params.temp , params.dynatemp_range , params.dynatemp_exponent ));
195195 break ;
196196 case COMMON_SAMPLER_TYPE_INFILL:
197- llama_sampler_chain_add (result->chain , llama_sampler_init_infill (model));
197+ llama_sampler_chain_add (result->chain , llama_sampler_init_infill (model));
198198 break ;
199199 case COMMON_SAMPLER_TYPE_PENALTIES:
200- llama_sampler_chain_add (result->chain , llama_sampler_init_penalties (params.penalty_last_n , params.penalty_repeat , params.penalty_freq , params.penalty_present ));
200+ llama_sampler_chain_add (result->chain , llama_sampler_init_penalties (params.penalty_last_n , params.penalty_repeat , params.penalty_freq , params.penalty_present ));
201+ break ;
202+ case COMMON_SAMPLER_TYPE_TOP_N_SIGMA:
203+ // llama_sampler_chain_add(result->chain, )
204+ llama_sampler_chain_add (result->chain , llama_sampler_init_top_n_sigma (params.top_n_sigma ))
201205 break ;
202206 default :
203207 GGML_ASSERT (false && " unknown sampler type" );
@@ -407,6 +411,7 @@ char common_sampler_type_to_chr(enum common_sampler_type cnstr) {
407411 case COMMON_SAMPLER_TYPE_XTC: return ' x' ;
408412 case COMMON_SAMPLER_TYPE_INFILL: return ' i' ;
409413 case COMMON_SAMPLER_TYPE_PENALTIES: return ' e' ;
414+ case COMMON_SAMPLER_TYPE_TOP_N_SIGMA: return ' s' ;
410415 default : return ' ?' ;
411416 }
412417}
@@ -422,6 +427,7 @@ std::string common_sampler_type_to_str(enum common_sampler_type cnstr) {
422427 case COMMON_SAMPLER_TYPE_XTC: return " xtc" ;
423428 case COMMON_SAMPLER_TYPE_INFILL: return " infill" ;
424429 case COMMON_SAMPLER_TYPE_PENALTIES: return " penalties" ;
430+ case COMMON_SAMPLER_TYPE_TOP_N_SIGMA: return " top_n_sigma" ;
425431 default : return " " ;
426432 }
427433}
@@ -437,6 +443,7 @@ std::vector<common_sampler_type> common_sampler_types_from_names(const std::vect
437443 { " xtc" , COMMON_SAMPLER_TYPE_XTC },
438444 { " infill" , COMMON_SAMPLER_TYPE_INFILL },
439445 { " penalties" , COMMON_SAMPLER_TYPE_PENALTIES },
446+ { " top_n_sigma" , COMMON_SAMPLER_TYPE_TOP_N_SIGMA },
440447 };
441448
442449 // since samplers names are written multiple ways
@@ -451,6 +458,9 @@ std::vector<common_sampler_type> common_sampler_types_from_names(const std::vect
451458 { " typ" , COMMON_SAMPLER_TYPE_TYPICAL_P },
452459 { " min-p" , COMMON_SAMPLER_TYPE_MIN_P },
453460 { " temp" , COMMON_SAMPLER_TYPE_TEMPERATURE },
461+ { " top-n-sigma" , COMMON_SAMPLER_TYPE_TOP_N_SIGMA },
462+ { " top-nsigma" , COMMON_SAMPLER_TYPE_TOP_N_SIGMA },
463+ { " top_nsigma" , COMMON_SAMPLER_TYPE_TOP_N_SIGMA },
454464 };
455465
456466 std::vector<common_sampler_type> samplers;
@@ -484,6 +494,7 @@ std::vector<common_sampler_type> common_sampler_types_from_chars(const std::stri
484494 { common_sampler_type_to_chr (COMMON_SAMPLER_TYPE_XTC), COMMON_SAMPLER_TYPE_XTC },
485495 { common_sampler_type_to_chr (COMMON_SAMPLER_TYPE_INFILL), COMMON_SAMPLER_TYPE_INFILL },
486496 { common_sampler_type_to_chr (COMMON_SAMPLER_TYPE_PENALTIES), COMMON_SAMPLER_TYPE_PENALTIES },
497+ { common_sampler_type_to_chr (COMMON_SAMPLER_TYPE_TOP_N_SIGMA), COMMON_SAMPLER_TYPE_TOP_N_SIGMA}
487498 };
488499
489500 std::vector<common_sampler_type> samplers;
0 commit comments