mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2025-10-14 23:58:11 +08:00
feat: support pass args before init web app
as title Former-commit-id: 434a5077288927e0be15cd066ca3e562111fad4d
This commit is contained in:
parent
64db4abc68
commit
e580d4ef41
@ -30,9 +30,7 @@ async def lifespan(app: FastAPI): # collects GPU memory
|
|||||||
torch_gc()
|
torch_gc()
|
||||||
|
|
||||||
|
|
||||||
def create_app():
|
def create_app(chat_model: ChatModel):
|
||||||
chat_model = ChatModel(*get_infer_args())
|
|
||||||
|
|
||||||
app = FastAPI(lifespan=lifespan)
|
app = FastAPI(lifespan=lifespan)
|
||||||
|
|
||||||
app.add_middleware(
|
app.add_middleware(
|
||||||
@ -124,5 +122,6 @@ def create_app():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app = create_app()
|
chat_model = ChatModel(*get_infer_args())
|
||||||
|
app = create_app(chat_model)
|
||||||
uvicorn.run(app, host="0.0.0.0", port=8000, workers=1)
|
uvicorn.run(app, host="0.0.0.0", port=8000, workers=1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user