Improve error reporting during server launch (#1390)

This commit is contained in:
Lianmin Zheng
2024-09-11 04:50:04 -07:00
committed by GitHub
parent 15c75e4146
commit c03cece42f

View File

@@ -447,13 +447,12 @@ def _wait_and_warmup(server_args, pipe_finish_writer, pid):
time.sleep(1) time.sleep(1)
try: try:
res = requests.get(url + "/get_model_info", timeout=5, headers=headers) res = requests.get(url + "/get_model_info", timeout=5, headers=headers)
assert res.status_code == 200, f"{res}" assert res.status_code == 200, f"{res=}, {res.text=}"
success = True success = True
break break
except (AssertionError, requests.exceptions.RequestException) as e: except (AssertionError, requests.exceptions.RequestException):
last_traceback = get_exception_traceback() last_traceback = get_exception_traceback()
pass pass
model_info = res.json()
if not success: if not success:
if pipe_finish_writer is not None: if pipe_finish_writer is not None:
@@ -462,6 +461,8 @@ def _wait_and_warmup(server_args, pipe_finish_writer, pid):
kill_child_process(pid, including_parent=False) kill_child_process(pid, including_parent=False)
return return
model_info = res.json()
# Send a warmup request # Send a warmup request
request_name = "/generate" if model_info["is_generation"] else "/encode" request_name = "/generate" if model_info["is_generation"] else "/encode"
max_new_tokens = 8 if model_info["is_generation"] else 1 max_new_tokens = 8 if model_info["is_generation"] else 1