# Unable to query downloads\_all\_time for a given model

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Funable-to-query-downloads-all-time-for-a-given-model%2F105929%3E%5C
**Category:** Models\
**Created:** [September 9, 2024, 3:31am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Funable-to-query-downloads-all-time-for-a-given-model%2F105929 "2024-09-09T03:31:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Umashanks99](https://avatars.discourse-cdn.com/v4/letter/u/e274bd/32.png) [@Umashanks99](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FUmashanks99)%5C
**Post date:** [September 9, 2024, 3:31am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Funable-to-query-downloads-all-time-for-a-given-model%2F105929%2F1 "2024-09-09T03:31:46Z")

</div>

I tried querying downloads\_all\_time for some models using [HF API Model Info](https://huggingface.co/docs/huggingface_hub/en/package_reference/hf_api#huggingface_hub.hf_api.ModelInfo)

But the downloads\_all\_time returns None

```auto
api = HfApi()

repo_id = "ai4bharat/IndicNER"

modelInfo = api.model_info(repo_id=repo_id)

```

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [September 9, 2024, 3:42am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Funable-to-query-downloads-all-time-for-a-given-model%2F105929%2F2 "2024-09-09T03:42:16Z")

</div>

It looks like you were able to do that the other day, but maybe the version of huggingface\_hub is out of date or buggy.  
Also, that URL is Spaces, not models. That could also be the cause.  
If you can’t get it to work, you’ll have to try snapshot\_download from the huggingface\_hub library.

> <https://github.com/huggingface/huggingface_hub/issues/2325>
>
> This can be done by using the \`/models\` endpoint and adding \`?expand:downloadsAl…lTime\`. 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 utils
> 
> \`\`\`
> from huggingface\_hub.utils.\_pagination import paginate
> api\_path = "https://huggingface.co/api/models"
> models = list(paginate(api\_path, params={"expand": "downloadsAllTime"}, headers={}))
> \`\`\`

---

<div class="post-metadata">

**Author:** ![nielsr](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nielsr/32/39617_2.png) [@nielsr](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fnielsr)%5C
**Post date:** [September 9, 2024, 8:14am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Funable-to-query-downloads-all-time-for-a-given-model%2F105929%2F3 "2024-09-09T08:14:22Z")

</div>

cc @Wauplin

---

<div class="post-metadata">

**Author:** ![Wauplin](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/wauplin/32/40815_2.png) [@Wauplin](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FWauplin)%5C
**Post date:** [September 9, 2024, 1:03pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Funable-to-query-downloads-all-time-for-a-given-model%2F105929%2F4 "2024-09-09T13:03:41Z")

</div>

The `downloadAllTime` attribute is not returned by default by the API. If you want to retrieve it, you must ask the server to do so using the `expand` parameter. Here is an example how to use it:

```py
>>> from huggingface_hub import model_info
>>> model = model_info("black-forest-labs/FLUX.1-dev", expand=["downloadsAllTime"])
>>> model.downloads_all_time
899419

```

`snapshot_download` on the other hand is a method to download files from a repo so not related to this topic.

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [September 9, 2024, 1:37pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Funable-to-query-downloads-all-time-for-a-given-model%2F105929%2F5 "2024-09-09T13:37:25Z")

</div>

Sorry. Oh, you meant the attribute of the total number of downloads. Come to think of it, there used to be only a monthly download count.  
I had mistaken it for some kind of download utility thing.😅

---

<div class="post-metadata">

**Author:** ![Wauplin](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/wauplin/32/40815_2.png) [@Wauplin](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FWauplin)%5C
**Post date:** [September 9, 2024, 2:50pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Funable-to-query-downloads-all-time-for-a-given-model%2F105929%2F6 "2024-09-09T14:50:34Z")

</div>

No worries and thanks for helping 🙂 `downloads` has always been there and is the “30 days downloads” but we’ve released a “downloads\_all\_time” sine a few months now 🙂
