Hugging face API for querying models metadata

I aim to conduct an analysis of the top 1000 most downloaded models across each category from the Hugging Face model repository for my academic project, with the objective of optimizing them. Could you advise on how to access metadata for these models, such as model size, number of parameters, model type, upload date, and number of downloads? what is the best way?

Could someone please help?

Hi,

You can leverage the huggingface_hub Python library for that.

Refer to the docs: https://huggingface.co/docs/huggingface_hub/guides/search#how-to-list-repositories-.

The ModelFilter class will be useful for you: HfApi Client.

Note, things like model_type are only supported for models which are natively supported in the Transformers library.

Thanks @nielsr !! Appreciate your help.