# Sort models by parameter count

**URL:** <https://discuss.huggingface.co/t/sort-models-by-parameter-count/104305>\
**Category:** Site Feedback\
**Created:** [August 28, 2024, 4:55am UTC](https://discuss.huggingface.co/t/sort-models-by-parameter-count/104305 "2024-08-28T04:55:38Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![mahmutc](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/mahmutc/32/52583_2.png) [@mahmutc](https://discuss.huggingface.co/u/mahmutc)\
**Post date:** [August 29, 2024, 5:33pm UTC](https://discuss.huggingface.co/t/sort-models-by-parameter-count/104305/5 "2024-08-29T17:33:55Z")

</div>

You can add filter option for `list_models` and change/add condition for file size.

```auto
from huggingface_hub import list_models, list_repo_files, hf_hub_url, get_hf_file_metadata

models = list_models()

for model in models:
  files = list_repo_files(model.id)
  for file in files:
    if file[-4:]==".bin":
      file_size = get_hf_file_metadata(hf_hub_url(model.id,file)).size
      if file_size // 1000000 > 1000: # if file bigger than 1gb
        print(model)
        print(f"{file_size // 1000000} mb")
        print("https://huggingface.co/"+model.id)

```

You can filter by #download/likes etc…

`ModelInfo(id='google-bert/bert-large-uncased', author=None, sha=None, created_at=datetime.datetime(2022, 3, 2, 23, 29, 4, tzinfo=datetime.timezone.utc), last_modified=None, private=False, gated=None, disabled=None, downloads=2524614, downloads_all_time=None, likes=108, library_name='transformers', tags=['transformers', 'pytorch', 'tf', 'jax', 'rust', 'safetensors', 'bert', 'fill-mask', 'en', 'dataset:bookcorpus', 'dataset:wikipedia', 'arxiv:1810.04805', 'license:apache-2.0', 'autotrain_compatible', 'endpoints_compatible', 'region:us'], pipeline_tag='fill-mask', mask_token=None, card_data=None, widget_data=None, model_index=None, config=None, transformers_info=None, siblings=None, spaces=None, safetensors=None)`

---

_[View the full topic](https://discuss.huggingface.co/t/sort-models-by-parameter-count/104305)._
