Add the ability to enable and disable the Profiler via HTTP API. (#1626)
This commit is contained in:
@@ -145,6 +145,28 @@ async def flush_cache():
|
||||
)
|
||||
|
||||
|
||||
@app.get("/start_profile")
|
||||
@app.post("/start_profile")
|
||||
async def start_profile():
|
||||
"""Start profiling."""
|
||||
tokenizer_manager.start_profile()
|
||||
return Response(
|
||||
content="Start profiling.\n",
|
||||
status_code=200,
|
||||
)
|
||||
|
||||
|
||||
@app.get("/stop_profile")
|
||||
@app.post("/stop_profile")
|
||||
async def stop_profile():
|
||||
"""Stop profiling."""
|
||||
tokenizer_manager.stop_profile()
|
||||
return Response(
|
||||
content="Stop profiling. This will take some time.\n",
|
||||
status_code=200,
|
||||
)
|
||||
|
||||
|
||||
@app.post("/update_weights")
|
||||
async def update_weights(obj: UpdateWeightReqInput, request: Request):
|
||||
"""Update the weights inplace without re-launching the server."""
|
||||
|
||||
Reference in New Issue
Block a user