How to get total number for downloads for a model

How can I know the total number for downloads of any model?

models = hf_api.list_models()

for model in models:
downloads = model.downloads if hasattr(model, ‘downloads’) else 0

is the download count returned my list_models APIs is total downloads and last weeks downloads ?

I believe you can make a call to their API.<username>/<repo>?expand%5B%5D=downloads&expand%5B%5D=downloadsAllTime

For example:[]=downloads&expand[]=downloadsAllTime

1 Like