Here's the source code of the function
def validate_supported(self, task: str) -> None:
"""
Confirm the contained model_name is deployed on the Inference API service.
Args:
task: Hugging Face task to check within. A list of all tasks can be
found here: https://huggingface.co/tasks
"""
all_models = self._sync_client.list_deployed_models(frameworks="all")
try:
if self.model_name not in all_models[task]:
raise ValueError(
"The Inference API service doesn't have the model"
f" {self.model_name!r} deployed."
)
except KeyError as exc:
raise KeyError(
f"Input task {task!r} not in possible tasks {list(all_models.keys())}."
) from exc