MCPcopy Create free account
hub / github.com/PaddlePaddle/FastDeploy / load_engine

Function load_engine

fastdeploy/entrypoints/openai/api_server.py:119–145  ·  view source on GitHub ↗

load engine

()

Source from the content-addressed store, hash-verified

117
118
119def load_engine():
120 """
121 load engine
122 """
123 global llm_engine
124 if llm_engine is not None:
125 return llm_engine
126
127 api_server_logger.info(f"FastDeploy LLM API server starting... {os.getpid()}, port: {args.port}")
128 engine_args = EngineArgs.from_cli_args(args)
129 if envs.FD_ENABLE_ASYNC_LLM:
130 engine = AsyncLLM.from_engine_args(engine_args, pid=args.port)
131 else:
132 engine = LLMEngine.from_engine_args(engine_args)
133 started = False
134 if isinstance(engine, AsyncLLM):
135 started = asyncio.run(engine.start())
136 else:
137 started = engine.start(api_server_pid=args.port)
138 if not started:
139 api_server_logger.error(
140 "Failed to initialize FastDeploy LLM engine, service exit now!"
141 "Please check the log file for more details."
142 )
143 return None
144 llm_engine = engine
145 return engine
146
147
148def load_data_service():

Callers 1

mainFunction · 0.85

Calls 6

from_cli_argsMethod · 0.80
infoMethod · 0.45
from_engine_argsMethod · 0.45
runMethod · 0.45
startMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected