-
Notifications
You must be signed in to change notification settings - Fork 846
Add HfApi.list_organization_models() to list organization models #3503
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
Add HfApi.list_organization_models() to list organization models #3503
Conversation
Wauplin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @BastienGimbert , it's actually already possible to list models from a given organization using list_models:
list_models(author=huggingface_hub)I'm therefore closing this PR. I do think it's best not to have multiple ways of doing the same thing. The /api/organizations/{organization}/models-json route is also less robust to pagination and only used to display models in the UI.
No problem 👍 thanks for the clarification! In any case, I would use these routes on my side to take advantage of the parameters . Out of curiosity, do you think it could still be useful to use some of the more “UI-oriented” routes like quicksearch or discussions in the SDK? |
|
For quicksearch I think we can yes. For discussions, what do you have in mind? We already have helpers to manage the community tab (list discussions and PRs, comment, open, close, merge, etc.). See https://huggingface.co/docs/huggingface_hub/guides/community |
For example, we could add all the sorting parameters. |
|
Signature of def get_repo_discussions(
self,
repo_id: str,
*,
author: Optional[str] = None,
discussion_type: Optional[constants.DiscussionTypeFilter] = None,
discussion_status: Optional[constants.DiscussionStatusFilter] = None,
repo_type: Optional[str] = None,
token: Union[bool, str, None] = None,
) -> Iterator[Discussion]:So it works for all types of repo (with |
Oh okay, good to know! |
Problem :
There was no function to list models from an organization on the Hub.
Summary :
Add HfApi.list_organization_models(organization, p=1, sort=None, search=None, token=None)
This calls /api/organizations/{organization}/models-json
Add a test to check the list returns ModelInfo objects.
Testing :
pytest -q tests/test_hf_api.py::UserApiTest::test_list_organization_models