From 4e755316516c36fe3600d8ac1dcfcac2232019d1 Mon Sep 17 00:00:00 2001 From: josc146 Date: Sun, 4 Jun 2023 11:53:33 +0800 Subject: [PATCH] fix the crash issue caused by temperature being 0 --- backend-python/utils/rwkv.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend-python/utils/rwkv.py b/backend-python/utils/rwkv.py index d224f62..6c94369 100644 --- a/backend-python/utils/rwkv.py +++ b/backend-python/utils/rwkv.py @@ -204,7 +204,10 @@ def set_rwkv_config(model: RWKV, body: ModelConfigBody): if body.max_tokens is not None: model.max_tokens_per_generation = body.max_tokens if body.temperature is not None: - model.temperature = body.temperature + if body.temperature < 0.1: + model.temperature = 0.1 + else: + model.temperature = body.temperature if body.top_p is not None: model.top_p = body.top_p if body.presence_penalty is not None: