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

sparsezoo.analyze #263

Merged
merged 8 commits into from
Feb 17, 2023
Merged

sparsezoo.analyze #263

merged 8 commits into from
Feb 17, 2023

Conversation

rahul-tuli
Copy link
Member

@rahul-tuli rahul-tuli commented Feb 14, 2023

sparsezoo.analyze

Current PR represents the feature branch for sparsezoo.analyze utility

This utility can be used to run ModelAnalysis on ONNX models, and prints
relevant summary to screen, if a --save option is given then the
complete analysis is written to the specified file

Usage

Usage: sparsezoo.analyze [OPTIONS] MODEL_PATH

  Model analysis for ONNX models.

  MODEL_PATH: can be a SparseZoo stub, or local path to a deployment-directory
  or ONNX model

  Examples:

  - Run model analysis on resnet

      sparsezoo.analyze ~/models/resnet50.onnx

Options:
  --save FILE  Path to a yaml file to write results to, note: file will be
               overwritten if exists
  --help       Show this message and exit.

Examples:
[UPDATED OUTPUT]

COMMAND:

sparsezoo3.9) 🥃 sparsezoo sparsezoo.analyze "zoo:cv/classification/resnet_v1-50/pytorch/sparseml/imagenet/pruned85_quant-none-vnni"

OUTPUT:

INFO:root:Downloading files from SparseZoo: 'zoo:cv/classification/resnet_v1-50/pytorch/sparseml/imagenet/pruned85_quant-none-vnni'
INFO:root:Starting Analysis ...
INFO:root:Analysis complete, collating results...
MODEL: zoo:cv/classification/resnet_v1-50/pytorch/sparseml/imagenet/pruned85_quant-none-vnni

PARAMETERS:
             Total  Percent Total %  Sparsity %  FP32 Precision %  INT8 Precision %
Weight  25502912.0            99.89       79.22              8.03             91.97
Bias       27560.0             0.11        0.00              3.63             96.37
Total   25530472.0           100.00       79.13              8.03             91.97

PARAMETERIZED OPS:
                  Total  Percent Total %  Sparsity %  FP32 Precision %  INT8 Precision %
QLinearConv  23481472.0            91.97       86.04              0.00            100.00
Gemm          2049000.0             8.03        0.00            100.00              0.00
Total        25530472.0           100.00       79.13              8.03             91.97

NON PARAMETERIZED OPS:
                   Total  Percent Total %  Sparsity %  FP32 Precision %  INT8 Precision %
Add                 16.0            18.39         0.0             100.0               0.0
Reshape              1.0             1.15         0.0             100.0               0.0
Unsqueeze            1.0             1.15         0.0             100.0               0.0
QuantizeLinear      17.0            19.54         0.0             100.0               0.0
Concat               1.0             1.15         0.0             100.0               0.0
Relu                13.0            14.94         0.0             100.0               0.0
GlobalAveragePool    1.0             1.15         0.0             100.0               0.0
Shape                1.0             1.15         0.0             100.0               0.0
DequantizeLinear    33.0            37.93         0.0             100.0               0.0
MaxPool              1.0             1.15         0.0             100.0               0.0
Softmax              1.0             1.15         0.0             100.0               0.0
Gather               1.0             1.15         0.0             100.0               0.0
Total               87.0           100.00         0.0             100.0               0.0

SUMMARY:
Number of Parameters: 25530472
Number of Operations: 25530559
Weight Sparsity %: 79.22
Quantized Parameterized Ops %: 91.97
Quantized Non-Parameterized Ops %: 0.0

KSGulin
KSGulin previously approved these changes Feb 14, 2023
Copy link
Contributor

@KSGulin KSGulin left a comment

Choose a reason for hiding this comment

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

Super clean. Excited to have this tool

KSGulin
KSGulin previously approved these changes Feb 14, 2023
Copy link
Contributor

@bfineran bfineran left a comment

Choose a reason for hiding this comment

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

LGTM pending coment

bfineran
bfineran previously approved these changes Feb 14, 2023
Copy link
Member

@markurtz markurtz left a comment

Choose a reason for hiding this comment

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

@rahul-tuli I've added more details into the PRD to prescribe the UX for presenting the results. The JSON works, but we'd like to format it into a more readable format. Attaching a screenshot from that PRD

@markurtz
Copy link
Member

Screen Shot 2023-02-15 at 8 19 20 AM

@rahul-tuli
Copy link
Member Author

Screen Shot 2023-02-15 at 8 19 20 AM

@markurtz Updated!

KSGulin
KSGulin previously approved these changes Feb 17, 2023
Copy link
Contributor

@KSGulin KSGulin left a comment

Choose a reason for hiding this comment

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

LGTM! Looks like there's a merge conflict to resolve

KSGulin
KSGulin previously approved these changes Feb 17, 2023
Copy link
Member

@markurtz markurtz left a comment

Choose a reason for hiding this comment

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

@rahul-tuli this is still printing out as a dict rather than the easier to read and more compact table format

@rahul-tuli rahul-tuli marked this pull request as draft February 17, 2023 13:42
@rahul-tuli rahul-tuli marked this pull request as ready for review February 17, 2023 14:15
@rahul-tuli rahul-tuli merged commit f1cbb6e into main Feb 17, 2023
@rahul-tuli rahul-tuli deleted the sparsezoo.analyze branch February 17, 2023 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants