Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hfapi.list_models() support list the top K trending models for TGI/TEI/Diffusion models #2427

Closed
weigary opened this issue Jul 30, 2024 · 8 comments · Fixed by #2448
Closed

Comments

@weigary
Copy link

weigary commented Jul 30, 2024

Is your feature request related to a problem? Please describe.
We are integrating with HF to get the top K TGI/TEI models and generate the deployment settings for these models. We need to have a way to get the top K trending models. Now it seems the only way is to use a crawler to crawl the page https://huggingface.co/models-json?sort=trending&p=1&other=text-generation-inference, which is not very reliable and inconvenient.

Describe the solution you'd like
Can we add a sort=trending option in this API, so that we can list all the models sorted by trending?

Describe alternatives you've considered

Additional context

@Wauplin
Copy link
Contributor

Wauplin commented Jul 30, 2024

Hi @weigary, yes this is already possible. The trending section is based on the likes received over the last 7 days. You can request them like this:

from huggingface_hub import HfApi

api = HfApi()

print("id, likes, downloads")
for model in api.list_models(filter="text-generation-inference", sort="likes7d", limit=5):
    print(model.id, model.likes, model.downloads)

which outputs:

id, likes, downloads
meta-llama/Meta-Llama-3.1-8B-Instruct 1129 338803
mistralai/Mistral-Large-Instruct-2407 556 5706
meta-llama/Meta-Llama-3.1-405B 528 48455
meta-llama/Meta-Llama-3.1-8B 368 96880
meta-llama/Meta-Llama-3.1-405B-Instruct 348 17717

Let me know if you have any further questions, otherwise feel free to close this issue 🤗

@weigary
Copy link
Author

weigary commented Jul 30, 2024

Thanks @Wauplin ! So IIUC the trending models is sorted by "likes7d"?

Thanks a lot!

@weigary
Copy link
Author

weigary commented Jul 30, 2024

Hi @Wauplin in the list_models() API, is there a way to filter out the models with gated=false? I see the ModelFilter was deprecated recently.

@Wauplin
Copy link
Contributor

Wauplin commented Jul 31, 2024

Hi @weigary, there is no way to search only for gated or non-gated models. You'll have to make your search and then filter out manually based on the gated field in the returned data. ModelFilter has been deprecated but it has never been possible to filter by gated. All fields that were in ModelFilter are now directly usable as parameters in list_models.

Is it ok to close this issue given the initial issue has been resolved? :)

@weigary
Copy link
Author

weigary commented Aug 3, 2024

thanks @Wauplin. Is it possible to add the additional filter (gated) in the list_models API, as a feature request?

@Wauplin
Copy link
Contributor

Wauplin commented Aug 12, 2024

Hi @weigary, I opened an internal ticket to track your feature request. I will let you know if and when it's implemented server-side. In the meantime, you can rely on the client-side filtering :)

@Wauplin
Copy link
Contributor

Wauplin commented Aug 14, 2024

Hi @weigary, happy to let you know that it's not possible to filter by "gated" status :)
I opened a new PR to integrate this to huggingface_hub #2448

@weigary
Copy link
Author

weigary commented Aug 14, 2024

Thanks @Wauplin for the quick action! Much appreciated!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants