runner.go: Support MinP parameter

MinP is a user-facing parameter that is exposed that is exposed
through the APIs but is not currently plumbed through.
This commit is contained in:
Jesse Gross 2024-08-21 16:13:54 -07:00 committed by jmorganca
parent 90d25d3b0a
commit 76718ead40
4 changed files with 5 additions and 0 deletions

View File

@ -387,6 +387,7 @@ type SamplingContext struct {
type SamplingParams struct {
TopK int
TopP float32
MinP float32
TfsZ float32
TypicalP float32
Temp float32
@ -406,6 +407,7 @@ func NewSamplingContext(params SamplingParams) *SamplingContext {
var cparams C.struct_llama_sampling_cparams
cparams.top_k = C.int32_t(params.TopK)
cparams.top_p = C.float(params.TopP)
cparams.min_p = C.float(params.MinP)
cparams.tfs_z = C.float(params.TfsZ)
cparams.typical_p = C.float(params.TypicalP)
cparams.temp = C.float(params.Temp)

View File

@ -434,6 +434,7 @@ func (s *Server) completion(w http.ResponseWriter, r *http.Request) {
var samplingParams llama.SamplingParams
samplingParams.TopK = req.TopK
samplingParams.TopP = req.TopP
samplingParams.MinP = req.MinP
samplingParams.TfsZ = req.TFSZ
samplingParams.TypicalP = req.TypicalP
samplingParams.Temp = req.Temperature

View File

@ -7,6 +7,7 @@ struct llama_sampling_context *llama_sampling_cinit(struct llama_sampling_cparam
llama_sampling_params sparams;
sparams.top_k = params->top_k;
sparams.top_p = params->top_p;
sparams.min_p = params->min_p;
sparams.tfs_z = params->tfs_z;
sparams.typical_p = params->typical_p;
sparams.temp = params->temp;

View File

@ -13,6 +13,7 @@ extern "C"
{
int32_t top_k;
float top_p;
float min_p;
float tfs_z;
float typical_p;
float temp;