-
Notifications
You must be signed in to change notification settings - Fork 601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support getting downloads from all time #2325
Comments
Agree on the need to provide that. I would rather add the For the record:
(those lists can be updated in the future) |
maybe some kind of |
Made some tests and to be consistent we should also update What I suggest for models:
>>> from huggingface_hub import model_info
>>> model = model_info("gpt2", expand=["downloadsAllTime"])
>>> model
ModelInfo(id='openai-community/gpt2', author=None, sha=None, created_at=None, last_modified=None, private=None, gated=None, disabled=None, downloads=None, downloads_all_time=585955419, likes=None, library_name=None, tags=None, pipeline_tag=None, mask_token=None, card_data=None, widget_data=None, model_index=None, config=None, transformers_info=None, siblings=None, spaces=None, safetensors=None)
>>> model.downloads_all_time
585955419 Anticipating the question, I prefer The "only" thing that bothers me with this solution is that it's not explicit to the user which |
sounds like a good plan. For 3., would it make sense to return something else than a |
Not very common IMO but that's the path we went for with the ModelInfo class already: id: str
author: Optional[str]
sha: Optional[str]
created_at: Optional[datetime]
last_modified: Optional[datetime]
private: bool
gated: Optional[Literal["auto", "manual", False]]
disabled: Optional[bool]
downloads: int
likes: int
library_name: Optional[str]
tags: List[str]
pipeline_tag: Optional[str]
mask_token: Optional[str]
card_data: Optional[ModelCardData]
widget_data: Optional[Any]
model_index: Optional[Dict]
config: Optional[Dict]
transformers_info: Optional[TransformersInfo]
siblings: Optional[List[RepoSibling]]
spaces: Optional[List[str]]
safetensors: Optional[SafeTensorsInfo] Having a few more optional fields would at least make things consistent even though it's not so satisfying. I'll check in parallel how I can draft a |
Updated PR for it (#2333) with everything we talked above. It's ready for review :) |
Closed by #2333. |
This can be done by using the
/models
endpoint and adding?expand:downloadsAllTime
. As it's a frequent request, it might be useful to support this directly in the library. Right now, I can do it with internal utilsThe text was updated successfully, but these errors were encountered: