Does anyone know if 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 the managing 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.
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 using https://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 with
response.links["next"] or use
There are a few parameters you can use, including:
None of this is integrated in
huggingface_hub yet but you use them already.
EDIT: I created an issue in
huggingface_hub: API to list Collections · Issue #1835 · huggingface/huggingface_hub · GitHub
Not sure how you ended up with this URL indeed The correct URL should be Managing collections (and for me it worked well by clicking on the side bar on the right).
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!