feat(backend): add guard in case top_k = 0
This commit is contained in:
parent
929a2fc718
commit
df72c56b5b
|
@ -28,7 +28,10 @@ namespace huggingface::tgi::backends::llamacpp {
|
||||||
false,
|
false,
|
||||||
false
|
false
|
||||||
));
|
));
|
||||||
|
|
||||||
|
if (top_k > 0) {
|
||||||
llama_sampler_chain_add(pSampler, llama_sampler_init_top_k(static_cast<int32_t>(top_k)));
|
llama_sampler_chain_add(pSampler, llama_sampler_init_top_k(static_cast<int32_t>(top_k)));
|
||||||
|
}
|
||||||
|
|
||||||
if (0 < top_p && top_p < 1) {
|
if (0 < top_p && top_p < 1) {
|
||||||
llama_sampler_chain_add(pSampler, llama_sampler_init_top_p(top_p, 1));
|
llama_sampler_chain_add(pSampler, llama_sampler_init_top_p(top_p, 1));
|
||||||
|
|
Loading…
Reference in New Issue