Skip to content

Commit c329d56

Browse files
[Inference Providers] Raise warning if provider's status is in error mode (#3141)
* update hint * add warning * Update src/huggingface_hub/inference/_providers/_common.py Co-authored-by: Lucain <[email protected]> --------- Co-authored-by: Lucain <[email protected]>
1 parent 987dadc commit c329d56

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/huggingface_hub/hf_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ class InferenceProviderMapping:
716716
provider: "PROVIDER_T" # Provider name
717717
hf_model_id: str # ID of the model on the Hugging Face Hub
718718
provider_id: str # ID of the model on the provider's side
719-
status: Literal["live", "staging"]
719+
status: Literal["error", "live", "staging"]
720720
task: str
721721

722722
adapter: Optional[str] = None

src/huggingface_hub/inference/_providers/_common.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ def _prepare_mapping_info(self, model: Optional[str]) -> InferenceProviderMappin
144144
logger.warning(
145145
f"Model {model} is in staging mode for provider {self.provider}. Meant for test purposes only."
146146
)
147+
if provider_mapping.status == "error":
148+
logger.warning(
149+
f"Our latest automated health check on model '{model}' for provider '{self.provider}' did not complete successfully. "
150+
"Inference call might fail."
151+
)
147152
return provider_mapping
148153

149154
def _prepare_headers(self, headers: Dict, api_key: str) -> Dict:

0 commit comments

Comments
 (0)