Skip to content

Commit a9adf8f

Browse files
authored
Add GGUF as supported expand[] parameter (#2545)
* Add GGUF as supported expand[] parameter * typo
1 parent c9458ad commit a9adf8f

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/huggingface_hub/hf_api.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@
154154
"downloads",
155155
"downloadsAllTime",
156156
"gated",
157+
"gguf",
157158
"inference",
158159
"lastModified",
159160
"library_name",
@@ -777,6 +778,7 @@ class ModelInfo:
777778
downloads: Optional[int]
778779
downloads_all_time: Optional[int]
779780
gated: Optional[Literal["auto", "manual", False]]
781+
gguf: Optional[Dict]
780782
inference: Optional[Literal["warm", "cold", "frozen"]]
781783
likes: Optional[int]
782784
library_name: Optional[str]
@@ -808,6 +810,7 @@ def __init__(self, **kwargs):
808810
self.downloads_all_time = kwargs.pop("downloadsAllTime", None)
809811
self.likes = kwargs.pop("likes", None)
810812
self.library_name = kwargs.pop("library_name", None)
813+
self.gguf = kwargs.pop("gguf", None)
811814
self.inference = kwargs.pop("inference", None)
812815
self.tags = kwargs.pop("tags", None)
813816
self.pipeline_tag = kwargs.pop("pipeline_tag", None)
@@ -1715,7 +1718,7 @@ def list_models(
17151718
expand (`List[ExpandModelProperty_T]`, *optional*):
17161719
List properties to return in the response. When used, only the properties in the list will be returned.
17171720
This parameter cannot be used if `full`, `cardData` or `fetch_config` are passed.
1718-
Possible values are `"author"`, `"baseModels"`, `"cardData"`, `"childrenModelCount"`, `"config"`, `"createdAt"`, `"disabled"`, `"downloads"`, `"downloadsAllTime"`, `"gated"`, `"inference"`, `"lastModified"`, `"library_name"`, `"likes"`, `"mask_token"`, `"model-index"`, `"pipeline_tag"`, `"private"`, `"safetensors"`, `"sha"`, `"siblings"`, `"spaces"`, `"tags"`, `"transformersInfo"`, `"trendingScore"` and `"widgetData"`.
1721+
Possible values are `"author"`, `"baseModels"`, `"cardData"`, `"childrenModelCount"`, `"config"`, `"createdAt"`, `"disabled"`, `"downloads"`, `"downloadsAllTime"`, `"gated"`, `"gguf"`, `"inference"`, `"lastModified"`, `"library_name"`, `"likes"`, `"mask_token"`, `"model-index"`, `"pipeline_tag"`, `"private"`, `"safetensors"`, `"sha"`, `"siblings"`, `"spaces"`, `"tags"`, `"transformersInfo"`, `"trendingScore"` and `"widgetData"`.
17191722
full (`bool`, *optional*):
17201723
Whether to fetch all model data, including the `last_modified`,
17211724
the `sha`, the files and the `tags`. This is set to `True` by
@@ -2413,7 +2416,7 @@ def model_info(
24132416
expand (`List[ExpandModelProperty_T]`, *optional*):
24142417
List properties to return in the response. When used, only the properties in the list will be returned.
24152418
This parameter cannot be used if `securityStatus` or `files_metadata` are passed.
2416-
Possible values are `"author"`, `"baseModels"`, `"cardData"`, `"childrenModelCount"`, `"config"`, `"createdAt"`, `"disabled"`, `"downloads"`, `"downloadsAllTime"`, `"gated"`, `"inference"`, `"lastModified"`, `"library_name"`, `"likes"`, `"mask_token"`, `"model-index"`, `"pipeline_tag"`, `"private"`, `"safetensors"`, `"sha"`, `"siblings"`, `"spaces"`, `"tags"`, `"transformersInfo"`, `"trendingScore"` and `"widgetData"`.
2419+
Possible values are `"author"`, `"baseModels"`, `"cardData"`, `"childrenModelCount"`, `"config"`, `"createdAt"`, `"disabled"`, `"downloads"`, `"downloadsAllTime"`, `"gated"`, `"gguf"`, `"inference"`, `"lastModified"`, `"library_name"`, `"likes"`, `"mask_token"`, `"model-index"`, `"pipeline_tag"`, `"private"`, `"safetensors"`, `"sha"`, `"siblings"`, `"spaces"`, `"tags"`, `"transformersInfo"`, `"trendingScore"` and `"widgetData"`.
24172420
token (Union[bool, str, None], optional):
24182421
A valid user access token (string). Defaults to the locally saved
24192422
token, which is the recommended method for authentication (see

tests/test_hf_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4222,7 +4222,7 @@ def _check_expand_property_is_up_to_date(self, repo_url: RepoUrl):
42224222
if should_be_added:
42234223
msg += f"\nNew arg(s) to support: {', '.join(should_be_added)}"
42244224
msg += f"\nPlease open a PR to update `./src/huggingface_hub/hf_api.py` accordingly. `{property_type_name}` should be updated as well as `{repo_type}_info` and `list_{repo_type}s` docstrings."
4225-
msg += "\nThanks you in advance!"
4225+
msg += "\nThank you in advance!"
42264226
raise ValueError(msg)
42274227

42284228

0 commit comments

Comments
 (0)