mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-06 00:57:33 +08:00
[Fix] mv connection_manager init (#3902)
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
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
* Update serving_chat.py * Update serving_completion.py * Update serving_completion.py * mv connection_manager init --------- Co-authored-by: Yuanle Liu <yuanlehome@163.com>
This commit is contained in:
@@ -182,6 +182,7 @@ async def lifespan(app: FastAPI):
|
|||||||
workers=args.workers,
|
workers=args.workers,
|
||||||
tool_parser=args.tool_call_parser,
|
tool_parser=args.tool_call_parser,
|
||||||
)
|
)
|
||||||
|
await engine_client.connection_manager.initialize()
|
||||||
app.state.dynamic_load_weight = args.dynamic_load_weight
|
app.state.dynamic_load_weight = args.dynamic_load_weight
|
||||||
model_handler = OpenAIServingModels(
|
model_handler = OpenAIServingModels(
|
||||||
model_paths,
|
model_paths,
|
||||||
|
@@ -74,12 +74,6 @@ class OpenAIServingChat:
|
|||||||
self.master_ip = "0.0.0.0"
|
self.master_ip = "0.0.0.0"
|
||||||
api_server_logger.info(f"master ip: {self.master_ip}")
|
api_server_logger.info(f"master ip: {self.master_ip}")
|
||||||
|
|
||||||
async def _ensure_connection_manager(self):
|
|
||||||
"""ensure connection manager initialized"""
|
|
||||||
if not self.engine_client.connection_initialized:
|
|
||||||
await self.engine_client.connection_manager.initialize()
|
|
||||||
self.engine_client.connection_initialized = True
|
|
||||||
|
|
||||||
def _check_master(self):
|
def _check_master(self):
|
||||||
return self.engine_client.is_master
|
return self.engine_client.is_master
|
||||||
|
|
||||||
@@ -206,7 +200,6 @@ class OpenAIServingChat:
|
|||||||
api_server_logger.info(f"create chat completion request: {request_id}")
|
api_server_logger.info(f"create chat completion request: {request_id}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await self._ensure_connection_manager()
|
|
||||||
dealer, response_queue = await self.engine_client.connection_manager.get_connection(request_id)
|
dealer, response_queue = await self.engine_client.connection_manager.get_connection(request_id)
|
||||||
dealer.write([b"", request_id.encode("utf-8")])
|
dealer.write([b"", request_id.encode("utf-8")])
|
||||||
choices = []
|
choices = []
|
||||||
@@ -419,7 +412,6 @@ class OpenAIServingChat:
|
|||||||
|
|
||||||
include_stop_str_in_output = request.include_stop_str_in_output
|
include_stop_str_in_output = request.include_stop_str_in_output
|
||||||
try:
|
try:
|
||||||
await self._ensure_connection_manager()
|
|
||||||
dealer, response_queue = await self.engine_client.connection_manager.get_connection(request_id)
|
dealer, response_queue = await self.engine_client.connection_manager.get_connection(request_id)
|
||||||
dealer.write([b"", request_id.encode("utf-8")])
|
dealer.write([b"", request_id.encode("utf-8")])
|
||||||
final_res = None
|
final_res = None
|
||||||
|
@@ -51,12 +51,6 @@ class OpenAIServingCompletion:
|
|||||||
else:
|
else:
|
||||||
self.master_ip = "0.0.0.0"
|
self.master_ip = "0.0.0.0"
|
||||||
|
|
||||||
async def _ensure_connection_manager(self):
|
|
||||||
"""ensure connection manager initialized"""
|
|
||||||
if not self.engine_client.connection_initialized:
|
|
||||||
await self.engine_client.connection_manager.initialize()
|
|
||||||
self.engine_client.connection_initialized = True
|
|
||||||
|
|
||||||
def _check_master(self):
|
def _check_master(self):
|
||||||
return self.engine_client.is_master
|
return self.engine_client.is_master
|
||||||
|
|
||||||
@@ -208,7 +202,6 @@ class OpenAIServingCompletion:
|
|||||||
try:
|
try:
|
||||||
request_ids = [f"{request_id}-{i}" for i in range(num_choices)]
|
request_ids = [f"{request_id}-{i}" for i in range(num_choices)]
|
||||||
# create dealer
|
# create dealer
|
||||||
await self._ensure_connection_manager()
|
|
||||||
dealer, response_queue = await self.engine_client.connection_manager.get_connection(
|
dealer, response_queue = await self.engine_client.connection_manager.get_connection(
|
||||||
request_id, num_choices
|
request_id, num_choices
|
||||||
)
|
)
|
||||||
@@ -314,7 +307,6 @@ class OpenAIServingCompletion:
|
|||||||
Process the stream completion request.
|
Process the stream completion request.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
await self._ensure_connection_manager()
|
|
||||||
dealer, response_queue = await self.engine_client.connection_manager.get_connection(
|
dealer, response_queue = await self.engine_client.connection_manager.get_connection(
|
||||||
request_id, num_choices
|
request_id, num_choices
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user