Skip to content

Commit

Permalink
fix api
Browse files Browse the repository at this point in the history
  • Loading branch information
hiyouga committed Jul 20, 2023
1 parent 6022adb commit 8333795
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/api_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
2 changes: 1 addition & 1 deletion src/llmtuner/api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 8333795

Please sign in to comment.