[fix] add more logger info: max_tokens (#5126)
CE Compile Job / ce_job_pre_check (push) Has been cancelled
CE Compile Job / print_ce_job_pre_check_outputs (push) Has been cancelled
CE Compile Job / FD-Clone-Linux (push) Has been cancelled
CE Compile Job / Show Code Archive Output (push) Has been cancelled
CE Compile Job / BUILD_SM8090 (push) Has been cancelled
CE Compile Job / BUILD_SM8689 (push) Has been cancelled
CE Compile Job / CE_UPLOAD (push) Has been cancelled

Co-authored-by: liqinrui <liqinrui@baidu.com>
This commit is contained in:
LiqinruiG
2025-11-19 18:44:27 +08:00
committed by GitHub
parent 9bb4337143
commit 2e4bab35fb
+7 -2
View File
@@ -295,7 +295,12 @@ class EngineClient:
if data.get("max_tokens") is not None:
if data["max_tokens"] < 1 or data["max_tokens"] >= self.max_model_len:
raise ParameterError("max_tokens", f"max_tokens can be defined [1, {self.max_model_len}).")
api_server_logger.error(
f"req_id:{data['request_id']}, max_tokens must be defined [1, {self.max_model_len}), but now it's {data['max_tokens']}."
)
raise ValueError(
f"max_tokens can be defined [1, {self.max_model_len}), but now it's {data['max_tokens']}."
)
if data.get("reasoning_max_tokens") is not None:
if data["reasoning_max_tokens"] < 1:
@@ -303,7 +308,7 @@ class EngineClient:
if data["reasoning_max_tokens"] > data["max_tokens"]:
data["reasoning_max_tokens"] = data["max_tokens"]
api_server_logger.warning(
f"req_id: {data['request_id']}, reasoning_max_tokens exceeds max_tokens, the value of reasoning_max_tokens will be adjusted to match that of max_tokens"
f"req_id: {data['request_id']}, reasoning_max_tokens exceeds max_tokens, the value of reasoning_max_tokens will be adjusted to {data['max_tokens']}"
)
if data.get("temperature") is not None and abs(data["temperature"]) < 1e-6:
data["temperature"] = 1e-6