mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-05 16:48:03 +08:00
[Bugfix] fix api server control signal bugs (#3531)
Some checks failed
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
Deploy GitHub Pages / deploy (push) Has been cancelled
Some checks failed
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
Deploy GitHub Pages / deploy (push) Has been cancelled
* Update serving_chat.py * Update serving_completion.py * Update serving_completion.py
This commit is contained in:
@@ -115,6 +115,7 @@ class OpenAIServingChat:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
error_msg = f"request[{request_id}] generator error: {str(e)}, {str(traceback.format_exc())}"
|
error_msg = f"request[{request_id}] generator error: {str(e)}, {str(traceback.format_exc())}"
|
||||||
api_server_logger.error(error_msg)
|
api_server_logger.error(error_msg)
|
||||||
|
self.engine_client.semaphore.release()
|
||||||
return ErrorResponse(code=400, message=error_msg)
|
return ErrorResponse(code=400, message=error_msg)
|
||||||
|
|
||||||
del current_req_dict
|
del current_req_dict
|
||||||
|
@@ -127,24 +127,24 @@ class OpenAIServingCompletion:
|
|||||||
api_server_logger.error(error_msg)
|
api_server_logger.error(error_msg)
|
||||||
return ErrorResponse(code=408, message=error_msg)
|
return ErrorResponse(code=408, message=error_msg)
|
||||||
|
|
||||||
|
try:
|
||||||
try:
|
try:
|
||||||
for idx, prompt in enumerate(request_prompts):
|
for idx, prompt in enumerate(request_prompts):
|
||||||
request_id_idx = f"{request_id}-{idx}"
|
request_id_idx = f"{request_id}-{idx}"
|
||||||
current_req_dict = request.to_dict_for_infer(request_id_idx, prompt)
|
current_req_dict = request.to_dict_for_infer(request_id_idx, prompt)
|
||||||
try:
|
|
||||||
current_req_dict["arrival_time"] = time.time()
|
current_req_dict["arrival_time"] = time.time()
|
||||||
prompt_token_ids = self.engine_client.format_and_add_data(current_req_dict)
|
prompt_token_ids = self.engine_client.format_and_add_data(current_req_dict)
|
||||||
if isinstance(prompt_token_ids, np.ndarray):
|
if isinstance(prompt_token_ids, np.ndarray):
|
||||||
prompt_token_ids = prompt_token_ids.tolist()
|
prompt_token_ids = prompt_token_ids.tolist()
|
||||||
text_after_process_list.append(current_req_dict.get("text_after_process"))
|
text_after_process_list.append(current_req_dict.get("text_after_process"))
|
||||||
prompt_batched_token_ids.append(prompt_token_ids)
|
prompt_batched_token_ids.append(prompt_token_ids)
|
||||||
|
del current_req_dict
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
error_msg = f"OpenAIServingCompletion format error: {e}, {str(traceback.format_exc())}"
|
error_msg = f"OpenAIServingCompletion format error: {e}, {str(traceback.format_exc())}"
|
||||||
api_server_logger.error(error_msg)
|
api_server_logger.error(error_msg)
|
||||||
|
self.engine_client.semaphore.release()
|
||||||
return ErrorResponse(message=str(e), code=400)
|
return ErrorResponse(message=str(e), code=400)
|
||||||
|
|
||||||
del current_req_dict
|
|
||||||
|
|
||||||
if request.stream:
|
if request.stream:
|
||||||
return self.completion_stream_generator(
|
return self.completion_stream_generator(
|
||||||
request=request,
|
request=request,
|
||||||
|
Reference in New Issue
Block a user