File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -187,9 +187,11 @@ std::string common_params_sampling::print() const {
187187struct common_sampler * common_sampler_init (const struct llama_model * model, struct common_params_sampling & params) {
188188 const llama_vocab * vocab = llama_model_get_vocab (model);
189189
190+ // if the user did not specify a value for penalty_last_n, set it to the model's context size
190191 if (params.penalty_last_n == -1 ) {
191192 params.penalty_last_n = llama_model_n_ctx_train (model);
192193 }
194+ // ensure that n_prev is at least as large as penalty_last_n, sampler needs to remember at least that many tokens for the penalties to work correctly
193195 params.penalty_last_n = std::max (params.penalty_last_n , 0 );
194196 params.n_prev = std::max (params.n_prev , params.penalty_last_n );
195197
You can’t perform that action at this time.
0 commit comments