feat(backend): add missing temperature parameter

This commit is contained in:
Morgan Funtowicz 2024-11-28 16:49:29 +01:00
parent df72c56b5b
commit 9d659f1e23
4 changed files with 5 additions and 0 deletions

View File

@ -37,6 +37,7 @@ namespace huggingface::tgi::backends::llamacpp {
llama_sampler_chain_add(pSampler, llama_sampler_init_top_p(top_p, 1));
}
llama_sampler_chain_add(pSampler, llama_sampler_init_temp(temperature));
llama_sampler_chain_add(pSampler, llama_sampler_init_dist(seed));
return {pSampler, llama_sampler_deleter};
}

View File

@ -48,6 +48,7 @@ namespace huggingface::tgi::backends::llamacpp {
float_t top_p = 1.0f;
float_t frequency_penalty = 0.0f;
float_t repetition_penalty = 0.0f;
float_t temperature = 0.0f;
uint64_t seed = 2014;
/**

View File

@ -104,6 +104,7 @@ impl From<&ValidParameters> for SamplingParams {
top_p: v.top_p,
frequency_penalty: v.frequency_penalty,
repetition_penalty: v.repetition_penalty,
temperature: v.temperature,
seed: v.seed,
}
}

View File

@ -10,6 +10,7 @@ impl Default for SamplingParams {
top_p: 1.0f32,
frequency_penalty: 0.0f32,
repetition_penalty: 0.0f32,
temperature: 1.0f32,
seed: 2014u64,
}
}
@ -29,6 +30,7 @@ mod ffi {
top_p: f32,
frequency_penalty: f32,
repetition_penalty: f32,
temperature: f32,
seed: u64,
}