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

graphql requests module #244

Merged
merged 20 commits into from
Mar 20, 2023
Merged

graphql requests module #244

merged 20 commits into from
Mar 20, 2023

Conversation

horheynm
Copy link
Member

@horheynm horheynm commented Dec 7, 2022

Use v2 api endpoints for search and downloads.

Please checkout the graphiql interactive UI to play around with the apis.
https://staging-api.neuralmagic.com/v2/graphql

Example query:

    {
        models (domain: "cv",task: "classification",architecture: "resnet_v1",subArchitecture: "50",framework: "pytorch",repo: "sparseml",sourceDataset: "imagenet",sparseTag: "pruned95_uniform_quant-none",)
            {
               modelId modelOnnxSizeCompressedBytes stub 
            }
    }

Screen Shot 2023-02-03 at 10 19 12 AM

src/sparsezoo/api/graphql.py Outdated Show resolved Hide resolved
src/sparsezoo/api/graphql.py Outdated Show resolved Hide resolved
src/sparsezoo/api/graphql.py Outdated Show resolved Hide resolved
src/sparsezoo/api/graphql.py Outdated Show resolved Hide resolved
src/sparsezoo/api/utils.py Outdated Show resolved Hide resolved
src/sparsezoo/model/utils.py Outdated Show resolved Hide resolved
src/sparsezoo/model/utils.py Outdated Show resolved Hide resolved
jeanniefinks and others added 2 commits February 1, 2023 00:00
license name change
search

search, download draft

draft, successful search and download

draft

Update: `ModelAnalysis.from_onnx(...)` to additionally work with loaded `ModelProto` (#253)

refactor

search, download
@horheynm horheynm force-pushed the graphql-requests branch 2 times, most recently from 49cb39a to c4426e9 Compare February 1, 2023 05:05
@horheynm horheynm marked this pull request as ready for review February 3, 2023 00:10
Copy link
Contributor

@dbogunowicz dbogunowicz left a comment

Choose a reason for hiding this comment

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

Left some tiny comments.
In general, as a reviewer I would love to have this split to one big feature branch and smaller PRs (much easier to review). Also, wouldn't hurt to leave more verbose docstrings.

@horheynm
Copy link
Member Author

horheynm commented Feb 3, 2023

Left some tiny comments.

In general, as a reviewer I would love to have this split to one big feature branch and smaller PRs (much easier to review). Also, wouldn't hurt to leave more verbose docstrings.

Thanks for the comments. A good reason for the length of the pr:
Ideally wanted to make prs for both search and downloads. But when search is called, downloads gets called in the original main branch's code (without downloading the actual file, just gets the download url). Was not easy to decouple the logic without making larger changes (will need to edit the Model class, and completely decouple load_files_from_stub)

src/sparsezoo/api/utils.py Outdated Show resolved Hide resolved
src/sparsezoo/model/utils.py Outdated Show resolved Hide resolved
src/sparsezoo/model/utils.py Outdated Show resolved Hide resolved
src/sparsezoo/model/utils.py Outdated Show resolved Hide resolved
src/sparsezoo/model/utils.py Outdated Show resolved Hide resolved
tdg5
tdg5 previously approved these changes Feb 6, 2023
Copy link
Contributor

@tdg5 tdg5 left a comment

Choose a reason for hiding this comment

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

Nothing glaring sticks out to me, though I would be interested to know if there's a good reason for making multiple graphql requests for a single model

@horheynm horheynm changed the title Dummy graphql requests module graphql requests module Mar 7, 2023
Copy link
Contributor

@corey-nm corey-nm left a comment

Choose a reason for hiding this comment

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

Looks great! Made a couple suggestions on structure, most are nits though. Left one comment about the sparse_tag, that's the only thing I saw that looked potentially wrong

src/sparsezoo/search/search.py Outdated Show resolved Hide resolved
src/sparsezoo/api/utils.py Show resolved Hide resolved
src/sparsezoo/model/result_utils.py Show resolved Hide resolved
src/sparsezoo/search/search.py Outdated Show resolved Hide resolved
src/sparsezoo/api/graphql.py Outdated Show resolved Hide resolved
src/sparsezoo/api/query_parser.py Outdated Show resolved Hide resolved
src/sparsezoo/api/graphql.py Outdated Show resolved Hide resolved
src/sparsezoo/model/utils.py Outdated Show resolved Hide resolved
src/sparsezoo/model/utils.py Show resolved Hide resolved
src/sparsezoo/model/utils.py Show resolved Hide resolved
corey-nm
corey-nm previously approved these changes Mar 13, 2023
Copy link
Contributor

@corey-nm corey-nm left a comment

Choose a reason for hiding this comment

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

Nice, looks good to me! 👍

src/sparsezoo/api/utils.py Outdated Show resolved Hide resolved
src/sparsezoo/api/utils.py Show resolved Hide resolved
src/sparsezoo/model/utils.py Outdated Show resolved Hide resolved
src/sparsezoo/model/utils.py Show resolved Hide resolved
src/sparsezoo/model/utils.py Show resolved Hide resolved
src/sparsezoo/search/search.py Outdated Show resolved Hide resolved
Copy link

@dfneuralmagic dfneuralmagic left a comment

Choose a reason for hiding this comment

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

LGTM

@horheynm horheynm merged commit 80feb81 into main Mar 20, 2023
@horheynm horheynm deleted the graphql-requests branch March 20, 2023 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants