huggingface / huggingface_hub

The official Python client for the Huggingface Hub.
https://huggingface.co/docs/huggingface_hub
Apache License 2.0
2.02k stars 531 forks source link

Add 'gated' search parameter #2448

Closed Wauplin closed 1 month ago

Wauplin commented 1 month ago

Close https://github.com/huggingface/huggingface_hub/issues/2427 cc @weigary

It is now possible to list models and datasets with gated=True or gated=False. By default (gated=None), all models/datasets are returned.

Example:

from huggingface_hub import HfApi

api = HfApi()

print("id, likes, downloads, gated")
for model in api.list_models(sort="likes7d", limit=5, gated=True, expand=["gated", "likes", "downloads"]):
    print(model.id, model.likes, model.downloads, model.gated)
id, likes, downloads, gated
black-forest-labs/FLUX.1-dev 1979 186639 auto
meta-llama/Meta-Llama-3.1-8B-Instruct 1778 1244445 manual
LGAI-EXAONE/EXAONE-3.0-7.8B-Instruct 289 10889 auto
stabilityai/stable-diffusion-3-medium 3968 207853 auto
google/gemma-2-2b-it 418 113700 manual

(thanks to server-side implementation -private link-)

HuggingFaceDocBuilderDev commented 1 month ago

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Wauplin commented 1 month ago

Thanks for the quick review :)