Former-commit-id: 4c3e8be325045e432b31c519132123c7b0689262
This commit is contained in:
hiyouga 2023-07-20 22:14:54 +08:00
parent 5dcd95645f
commit 2006a96570
2 changed files with 5 additions and 2 deletions

View File

@ -5,11 +5,14 @@
import uvicorn
from llmtuner import ChatModel
from llmtuner.api.app import create_app
from llmtuner.tuner import get_infer_args
def 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)

View File

@ -30,7 +30,7 @@ async def lifespan(app: FastAPI): # collects GPU memory
torch_gc()
def create_app(chat_model: ChatModel):
def create_app(chat_model: ChatModel) -> FastAPI:
app = FastAPI(lifespan=lifespan)
app.add_middleware(