Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions fastdeploy/engine/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ def add_requests(self, task, sampling_params=None, **kwargs):
request = Request.from_dict(task)
llm_logger.info(f"Receive request {request}")
if sampling_params is not None:
if sampling_params.temperature is not None and abs(sampling_params.temperature) < 1e-06:
sampling_params.temperature = 1e-06
request.sampling_params = sampling_params
request.preprocess_start_time = time.time()
chat_template_kwargs = kwargs.get("chat_template_kwargs") or {}
Expand Down
3 changes: 2 additions & 1 deletion fastdeploy/entrypoints/engine_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,8 @@ def valid_parameters(self, data):
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"
)

if data.get("temperature") is not None and abs(data["temperature"]) < 1e-6:
data["temperature"] = 1e-6
# logprobs
logprobs = data.get("logprobs")
top_logprobs = None
Expand Down
13 changes: 13 additions & 0 deletions tests/entrypoints/test_engine_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@ async def test_add_request(self):
assert request["tools"] == [1]
# assert request["chat_template_kwargs"]["tools"] == [1]

def test_valid_parameters(self):
request = {
"request_id": "test-request-id",
"chat_template_kwargs": {"enable_thinking": True},
"prompt_token_ids": [1],
"chat_template": "Hello",
"max_tokens": 20,
"tools": [1],
"temperature": 0,
}
self.engine_client.valid_parameters(request)
assert request["temperature"] == 1e-6


if __name__ == "__main__":
unittest.main()
Loading