Skip to content

Commit

Permalink
Add example for get_model_status
Browse files Browse the repository at this point in the history
  • Loading branch information
Wauplin committed Sep 8, 2023
1 parent 681815c commit 3734d74
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/huggingface_hub/inference/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1894,6 +1894,14 @@ def get_model_status(self, model: Optional[str] = None) -> ModelStatus:
Returns:
[`ModelStatus`]: An instance of ModelStatus dataclass, containing information,
about the state of the model: load, state, compute type and framework.
Example:
```py
>>> from huggingface_hub import InferenceClient
>>> client = InferenceClient()
>>> client.get_model_status("bigcode/starcoder")
ModelStatus(loaded=True, state='Loaded', compute_type='gpu', framework='text-generation-inference')
```
"""
model = model or self.model
if model is None:
Expand Down
9 changes: 9 additions & 0 deletions src/huggingface_hub/inference/_generated/_async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1923,6 +1923,15 @@ async def get_model_status(self, model: Optional[str] = None) -> ModelStatus:
Returns:
[`ModelStatus`]: An instance of ModelStatus dataclass, containing information,
about the state of the model: load, state, compute type and framework.
Example:
```py
# Must be run in an async context
>>> from huggingface_hub import AsyncInferenceClient
>>> client = AsyncInferenceClient()
>>> await client.get_model_status("bigcode/starcoder")
ModelStatus(loaded=True, state='Loaded', compute_type='gpu', framework='text-generation-inference')
```
"""
model = model or self.model
if model is None:
Expand Down

0 comments on commit 3734d74

Please sign in to comment.