minor: update gsm8k threshold (#2125)

This commit is contained in:
Yineng Zhang
2024-11-22 19:23:58 +08:00
committed by GitHub
parent 2369e88209
commit 4f8c3aeafc
3 changed files with 45 additions and 35 deletions

View File

@@ -439,18 +439,22 @@ def popen_launch_server(
process = subprocess.Popen(command, stdout=None, stderr=None, env=env)
start_time = time.time()
while time.time() - start_time < timeout:
try:
headers = {
"Content-Type": "application/json; charset=utf-8",
"Authorization": f"Bearer {api_key}",
}
response = requests.get(f"{base_url}/health_generate", headers=headers)
if response.status_code == 200:
return process
except requests.RequestException:
pass
time.sleep(10)
with requests.Session() as session:
while time.time() - start_time < timeout:
try:
headers = {
"Content-Type": "application/json; charset=utf-8",
"Authorization": f"Bearer {api_key}",
}
response = session.get(
f"{base_url}/health_generate",
headers=headers,
)
if response.status_code == 200:
return process
except requests.RequestException:
pass
time.sleep(10)
raise TimeoutError("Server failed to start within the timeout period.")