Fix fastchat top_k (#10560)

* fix -1 top_k

* fix

* done
This commit is contained in:
Guancheng Fu 2024-03-27 16:01:58 +08:00 committed by GitHub
parent fc8c7904f0
commit 04baac5a2e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -100,7 +100,9 @@ class BigDLLLMWorker(BaseModelWorker):
temperature = float(params.get("temperature", 1.0))
repetition_penalty = float(params.get("repetition_penalty", 1.0))
top_p = float(params.get("top_p", 1.0))
top_k = int(params.get("top_k", 0)) # 0 means disable
top_k = int(params.get("top_k", 1))
if top_k == -1:
top_k = 1
max_new_tokens = int(params.get("max_new_tokens", 256))
echo = bool(params.get("echo", True))
stop_str = params.get("stop", None)