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

Namespace Objects for Search Parameters #556

Merged
merged 9 commits into from
Dec 22, 2021

Conversation

muellerzr
Copy link
Contributor

@muellerzr muellerzr commented Dec 21, 2021

PR that adds the following:

Namespace Objects for Search Parameters

With a goal of adding more tab-completion to the library, this PR introduces two objects:

  • DatasetSearchArguments
  • ModelSearchArguments
    These two AttributeDictionary objects contain all the valid information we can extract from a model as tab-complete parameters. We also include the author_or_organization and dataset (or model) _name as well through careful string splitting.

Tests Added:

Considering there is nothing "new" done in DatasetSearchArguments that isn't already tested in DatasetTags or AttributeDictionary.search I chose not to add any tests here (especially because each call to the SearchArguments() classes calls the api twice)

If tests are wanted, I can include them.

@muellerzr muellerzr requested review from LysandreJik and removed request for LysandreJik December 21, 2021 18:01
@muellerzr muellerzr marked this pull request as draft December 21, 2021 18:09
@muellerzr muellerzr marked this pull request as ready for review December 21, 2021 18:17
@muellerzr muellerzr added the enhancement New feature or request label Dec 21, 2021
@muellerzr muellerzr changed the title Add search functionality to AttributeDictionary Namespace Objects for Search Parameters, and add search functionality to AttributeDictionary Dec 21, 2021
@muellerzr
Copy link
Contributor Author

muellerzr commented Dec 22, 2021

Realized I never quite said how they're related. It's a quality of life need for our users. For example, say I want to use the ModelSearchArguments, and I'd like to know if there are models with resnet I can use. I do:

args = ModelSearchArguments()
args.model_name.search("resnet")

To return all of the models that contain the name resnet

(This then trickles to anything using AttributeDictionary too)

@muellerzr muellerzr mentioned this pull request Dec 22, 2021
6 tasks
@muellerzr muellerzr changed the title Namespace Objects for Search Parameters, and add search functionality to AttributeDictionary Namespace Objects for Search Parameters Dec 22, 2021
Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, I like this a lot. Thanks for iterating with me on this, I think this should provide some very useful tooling for the model_list/dataset_list, and should provide a good platform on which we can build some useful methods in transformers and others.

@LysandreJik
Copy link
Member

LysandreJik commented Dec 22, 2021

As said offline; the search argument was a bit overkill for a first version, so thanks for removing it for now. I think these namespaces are quite simple and can be further iterated once we identify community usage/requests.

@muellerzr muellerzr merged commit 63b04d4 into huggingface:main Dec 22, 2021
@muellerzr muellerzr deleted the search-args branch December 22, 2021 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants