Hub Collections
Hi everyone,Does anyone knowif a list of all collections can be retrieved either using the Hub client library or an API endpoint?Also, I couldn’t find the way of getting the collection of a specific repository. I’ve checked themanaging collection docs(I think the links of the right side don’t work, if anyone could check it), but it only gives info about retrieving a collection knowing its name.Thank you,Adem
2023-11-17T09:49:18Z
if a list of all collections can be retrieved either using the Hub client library or an API endpoint?Yes it is possible, yet not officially documented usinghttps://huggingface.co/api/collections.Results are paginated so if you want to get all collections, you will have to follow the “Link” (ref=next) header. If you use Python, you can access it withresponse.links["next"]or usehuggingface_hub.utils.paginate.There are a few parameters you can use, including:limitto limit the number of resultsitem(string list) to filter collections that contain a given item. Example:https://huggingface.co/api/collections?item=models/gpt2returns all collections listinggpt2owner(string list). Example: collection from TheBlokehttps://huggingface.co/api/collections?owner=TheBlokesortto sort collections by"trending"(default order),"upvotes"or"lastModified"None of this is integrated inhuggingface_hubyet but you use them already.EDIT:I created an issue inhuggingface_hub:API to list Collections · Issue #1835 · huggingface/huggingface_hub · GitHub
2023-11-17T09:59:59Z
ademait:I think the links of the right side don’t work, if anyone could check it)Not sure how you ended up with this URL indeedThe correct URL should beManaging collections(and for me it worked well by clicking on the side bar on the right).
2023-11-17T10:19:40Z
Hi@Wauplin, right know I don’t remember though. However, the link you shared worked for me. I’ll check the issue too, thanks for addressing the topic!