Skip to content

Instantly share code, notes, and snippets.

@stas00
Last active December 10, 2021 01:47
Show Gist options
  • Save stas00/a98c4f0846e1b75541b9bbba28f3b185 to your computer and use it in GitHub Desktop.
Save stas00/a98c4f0846e1b75541b9bbba28f3b185 to your computer and use it in GitHub Desktop.
most popular HF model downloads by architecture (thanks to @LysandreJik)
from transformers import CONFIG_MAPPING
from huggingface_hub import HfApi
api = HfApi()
keys = list(CONFIG_MAPPING.keys())
downloads = {}
for key in keys:
models = api.list_models(filter=key)
total_downloads = sum(model.downloads if hasattr(model, "downloads") else 0 for model in models)
downloads[key] = total_downloads
ordered = sorted(downloads.items(), reverse=True, key=lambda t: t[1])
for key, value in ordered:
print(f"Architecture {key} has {value} total downloads")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment