Skip to main content

Neural network model repository for highly sparse and sparse-quantized models with matching sparsification recipes

Project description

tool icon  SparseZoo

Neural network model repository for highly sparse and sparse-quantized models with matching sparsification recipes

Documentation Main GitHub release GitHub Contributor Covenant

Overview

SparseZoo is a constantly-growing repository of sparsified (pruned and pruned-quantized) models with matching sparsification recipes for neural networks. It simplifies and accelerates your time-to-value in building performant deep learning models with a collection of inference-optimized models and recipes to prototype from. Read more about sparsification here.

Available via API and hosted in the cloud, the SparseZoo contains both baseline and models sparsified to different degrees of inference performance vs. baseline loss recovery. Recipe-driven approaches built around sparsification algorithms allow you to use the models as given, transfer-learn from the models onto private datasets, or transfer the recipes to your architectures.

The GitHub repository contains the Python API code to handle the connection and authentication to the cloud.

SparseZoo Flow

Highlights

Installation

This repository is tested on Python 3.6-3.9, and Linux/Debian systems. It is recommended to install in a virtual environment to keep your system in order.

Install with pip using:

pip install sparsezoo

Quick Tour

Python APIs

The Python APIs respect this format enabling you to search and download models. Some code examples are given below. The SparseZoo UI also enables users to load models by copying a stub directly from a model page.

Loading from a Stub

from sparsezoo import Model

# copied from https://sparsezoo.neuralmagic.com/
stub = "zoo:cv/classification/resnet_v1-50/pytorch/sparseml/imagenet/pruned90_quant-none"
model = Model(stub)
print(model)

Searching the Zoo

from sparsezoo import search_models

models = search_models(
    domain="cv",
    sub_domain="classification",
    return_stubs=True,
)
print(models)

Environmental Variables

Users can specify the directory where models (temporarily during download) and its required credentials will be saved in your working machine. SPARSEZOO_MODELS_PATH is the path where the downloaded models will be saved temporarily. Default ~/.cache/sparsezoo/ SPARSEZOO_CREDENTIALS_PATH is the path where credentials.yaml will be saved. Default ~/.cache/sparsezoo/

Console Scripts

In addition to the Python APIs, a console script entry point is installed with the package sparsezoo. This enables easy interaction straight from your console/terminal.

Downloading

Download command help

sparsezoo.download -h


Download ResNet-50 Model

sparsezoo.download zoo:cv/classification/resnet_v1-50/pytorch/sparseml/imagenet/base-none


Download pruned and quantized ResNet-50 Model

sparsezoo.download zoo:cv/classification/resnet_v1-50/pytorch/sparseml/imagenet/pruned_quant-moderate

Searching

Search command help

sparsezoo search -h


Searching for all classification MobileNetV1 models in the computer vision domain

sparsezoo search --domain cv --sub-domain classification --architecture mobilenet_v1


Searching for all ResNet-50 models

sparsezoo search --domain cv --sub-domain classification \
    --architecture resnet_v1 --sub-architecture 50

For a more in-depth read, check out SparseZoo documentation.

Resources

Learning More

Release History

Official builds are hosted on PyPI

Additionally, more information can be found via GitHub Releases.

License

The project is licensed under the Apache License Version 2.0.

Community

Contribute

We appreciate contributions to the code, examples, integrations, and documentation as well as bug reports and feature requests! Learn how here.

Join

For user help or questions about SparseZoo, sign up or log in to our Deep Sparse Community Slack. We are growing the community member by member and happy to see you there. Bugs, feature requests, or additional questions can also be posted to our GitHub Issue Queue.

You can get the latest news, webinar and event invites, research papers, and other ML Performance tidbits by subscribing to the Neural Magic community.

For more general questions about Neural Magic, please fill out this form.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

sparsezoo_nightly-1.1.0.20220819-py3-none-any.whl (87.8 kB view details)

Uploaded Python 3

File details

Details for the file sparsezoo_nightly-1.1.0.20220819-py3-none-any.whl.

File metadata

  • Download URL: sparsezoo_nightly-1.1.0.20220819-py3-none-any.whl
  • Upload date:
  • Size: 87.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.6.9

File hashes

Hashes for sparsezoo_nightly-1.1.0.20220819-py3-none-any.whl
Algorithm Hash digest
SHA256 af281c76e1d604ef2acb52cf28e03930bba42ba5048b65f791c7e2d61ac4ce3e
MD5 898ee6d641204aa74ca44cf4f7d4c77c
BLAKE2b-256 307dff837bd144ee0bee69d13b723464ce51d1e8e36d98568d0926d53f7b32de

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page