
Hugging Face Blog
路 2 min read
Supercharged Searching on the 馃 Hub
The huggingface_hub library is a lightweight interface that provides a programmatic approach to exploring the hosting endpoints Hugging Face provides: models, datasets, and Spaces.
Up until now, searching on the Hub through this interface was tricky to pull off, and there were many aspects of it a user had to "just know" and get accustomed to.
In this article, we will be looking at a few exciting new features added to huggingface_hub to help lower that bar and provide users with a friendly API to search for the models and datasets they want to use without leaving their Jupyter or Python interfaces.
Before we begin, if you do not have the latest version of the
huggingface_hublibrary on your system, please run the following cell:
!pip install huggingface_hub -U
Situating the Problem:
First, let's imagine the scenario you are in. You'd like to find all models hosted on the Hugging Face Hub for Text Classification, were trained on the GLUE dataset, and are compatible with PyTorch.
You may simply just open https://huggingface.co/models and use the widgets on there. But this requires leaving your IDE and scanning those results, all of which requires a few button clicks to get you the information you need.
What if there were a solution to this without having to leave your IDE? With a programmatic interface, it also could be easy to see this being integrated into workflows for exploring the Hub.
This is where the huggingface_hub comes in.
For those familiar with the library, you may already know that we can search for these type of models. However, getting the query right is a painful process of trial and error.
Could we simplify that? Let's find out!
Finding what we need
First we'll import the HfApi, which is a class that helps us interact with the backend hosting for Hugging Face. We can interact with the models, datasets, and more through it. Along with this, we'll import a few helper classes: the ModelFilter and ModelSearchArguments
Let's take a peek:
'text-classification'
'pytorch'
4
Original source
This story was published by Hugging Face Blog. SyncAI.news shows a preview; the complete article is on the publisher's site.
Read the full story on huggingface.co


