Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion scripts/wake_up_hf_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import time

from aiohttp.client_exceptions import ClientResponseError
from huggingface_hub.errors import HfHubHTTPError

from any_llm.api import completion

Expand All @@ -17,7 +18,7 @@ def wake_up_hf_endpoint(retry_count: int = 0, retry_interval: int = 10):
completion(
model="huggingface:tgi", messages=[{"role": "user", "content": "Are you awake?"}], api_base=HF_ENDPOINT
)
except ClientResponseError as e:
except (ClientResponseError, HfHubHTTPError) as e:
attempt += 1
if attempt >= max_attempts:
print(f"Endpoint not ready after {attempt} attempts, giving up...\n{e}")
Expand Down