llama.cpp: Add top_n_sigma, fix typical_p in sampler priority

This commit is contained in:
oobabooga 2025-05-06 06:38:39 -07:00
parent cbef35054c
commit d1c0154d66
2 changed files with 5 additions and 2 deletions

View file

@ -66,6 +66,7 @@ class LlamaServer:
"top_k": state["top_k"],
"top_p": state["top_p"],
"min_p": state["min_p"],
"top_n_sigma": state["top_n_sigma"] if state["top_n_sigma"] > 0 else -1,
"tfs_z": state["tfs"],
"typical_p": state["typical_p"],
"repeat_penalty": state["repetition_penalty"],
@ -102,8 +103,10 @@ class LlamaServer:
penalty_found = False
for s in samplers:
if s.strip() in ["dry", "top_k", "typ_p", "top_p", "min_p", "xtc", "temperature"]:
if s.strip() in ["dry", "top_k", "top_p", "top_n_sigma", "min_p", "temperature", "xtc"]:
filtered_samplers.append(s.strip())
elif s.strip() == "typical_p":
filtered_samplers.append("typ_p")
elif not penalty_found and s.strip() == "repetition_penalty":
filtered_samplers.append("penalties")
penalty_found = True

View file

@ -52,7 +52,7 @@ def default_preset():
if shared.args.portable:
samplers = result['sampler_priority'].split('\n')
samplers = [sampler for sampler in samplers if sampler in ["dry", "top_k", "typ_p", "top_p", "min_p", "xtc", "temperature", "repetition_penalty"]]
samplers = [sampler for sampler in samplers if sampler in ["dry", "top_k", "top_p", "top_n_sigma", "min_p", "temperature", "xtc", "typical_p", "repetition_penalty"]]
result['sampler_priority'] = '\n'.join(samplers)
return result