Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.PHONY: build docs test

BUILDDIR := $(PWD)
CHECKDIRS := examples notebooks scripts src tests utils setup.py
CHECKGLOBS := 'examples/**/*.py' 'scripts/**/*.py' 'src/**/*.py' 'tests/**/*.py' 'utils/**/*.py' setup.py
CHECKDIRS := integrations notebooks scripts src tests utils setup.py
CHECKGLOBS := 'integrations/**/*.py' 'scripts/**/*.py' 'src/**/*.py' 'tests/**/*.py' 'utils/**/*.py' setup.py
DOCDIR := docs
MDCHECKGLOBS := 'docs/**/*.md' 'docs/**/*.rst' 'examples/**/*.md' 'notebooks/**/*.md' 'scripts/**/*.md'
MDCHECKGLOBS := 'docs/**/*.md' 'docs/**/*.rst' 'integrations/**/*.md' 'notebooks/**/*.md' 'scripts/**/*.md'
MDCHECKFILES := CODE_OF_CONDUCT.md CONTRIBUTING.md DEVELOPING.md README.md

BUILD_ARGS := # set nightly to build nightly release
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ Install with pip using:
pip install sparseml
```

Then if you would like to explore any of the [scripts](https://github.com/neuralmagic/sparseml/blob/main/scripts/), [notebooks](https://github.com/neuralmagic/sparseml/blob/main/notebooks/), or [examples](https://github.com/neuralmagic/sparseml/blob/main/examples/)
Then if you would like to explore any of the [scripts](https://github.com/neuralmagic/sparseml/blob/main/scripts/), [notebooks](https://github.com/neuralmagic/sparseml/blob/main/notebooks/), or [integrations](https://github.com/neuralmagic/sparseml/blob/main/integrations/)
clone the repository and install any additional dependencies as required.

#### Supported Framework Versions
Expand Down Expand Up @@ -343,7 +343,7 @@ Note, TensorFlow V1 is no longer being built for newer operating systems such as

## Contributing

We appreciate contributions to the code, examples, and documentation as well as bug reports and feature requests! [Learn how here](https://github.com/neuralmagic/sparseml/blob/main/CONTRIBUTING.md).
We appreciate contributions to the code, examples, integrations, and documentation as well as bug reports and feature requests! [Learn how here](https://github.com/neuralmagic/sparseml/blob/main/CONTRIBUTING.md).

## Join the Community

Expand Down
2 changes: 1 addition & 1 deletion docs/source/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ Install with pip using:
pip install sparseml
```

Then if you would like to explore any of the [scripts](https://github.com/neuralmagic/sparseml/tree/main/scripts), [notebooks](https://github.com/neuralmagic/sparseml/tree/main/notebooks), or [examples](https://github.com/neuralmagic/sparseml/tree/main/examples) clone the repository and install any additional dependencies as required.
Then if you would like to explore any of the [scripts](https://github.com/neuralmagic/sparseml/tree/main/scripts), [notebooks](https://github.com/neuralmagic/sparseml/tree/main/notebooks), or [integrations](https://github.com/neuralmagic/sparseml/tree/main/integrations) clone the repository and install any additional dependencies as required.
4 changes: 2 additions & 2 deletions examples/README.md → integrations/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ See the License for the specific language governing permissions and
limitations under the License.
-->

# Examples
# Integrations

This directory contains self-documented examples of SparseML workflows and integrations
with other libraries. Open a Pull Request to
[contribute](https://github.com/neuralmagic/sparseml/blob/main/CONTRIBUTING.md)
your own.
your own.
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
"""
Example of pruning a ResNet20-v1 model pretrained on the Cifar-10 dataset.
The pretrained model and this pruning script were adapted from:
https://keras.io/zh/examples/cifar10_resnet/
https://keras.io/zh/integrations/cifar10_resnet/

Run the following command from the top repo directory:

python3 examples/keras/prune_resnet20.py
python3 integrations/keras/prune_resnet20.py

"""

Expand All @@ -41,7 +41,7 @@


# Root directory
root_dir = "./examples/keras"
root_dir = "./integrations/keras"

# Logging setup
log_dir = os.path.join(root_dir, "tensorboard", "resnet20_v1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ To begin, run `pip install sparseml[torchvision]`

## Notebook
For a quick, step-by-step walk-through of performing the integration and pruning a model run through the
[pruning.ipynb](https://github.com/neuralmagic/sparseml/blob/main/examples/pytorch-torchvision/pruning.ipynb) notebook.
[pruning.ipynb](https://github.com/neuralmagic/sparseml/blob/main/integrations/pytorch-torchvision/pruning.ipynb) notebook.

Run `jupyter notebook` in your terminal and navigate to the notebook in your browser to get started.

## Script
`examples/pytorch-torchvision/main.py` is an ease-of-use script for applying a SparseML optimization recipe to a torchvision classification model.
`integrations/pytorch-torchvision/main.py` is an ease-of-use script for applying a SparseML optimization recipe to a torchvision classification model.
The script file is fully documented with descriptions, a command help printout, and example commands.
You can also run `python examples/pytorch-torchvision/main.py -h` for a help printout.
You can also run `python integrations/pytorch-torchvision/main.py -h` for a help printout.

To run this script, you will need a SparseML recipe as well as an
[ImageFolder](https://pytorch.org/docs/stable/torchvision/datasets.html#imagefolder)-like classification dataset to train
Expand All @@ -59,7 +59,7 @@ in the script file documentation. The optimization learning rate, and number of

example command:
```bash
python examples/pytorch-torchvision/main.py \
python integrations/pytorch-torchvision/main.py \
--recipe-path ~/sparseml_recipes/pruning_resnet50.yaml \
--model resnet50 \
--imagefolder-path ~/datasets/my_imagefolder \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@

##########
Example command for pruning resnet50 on an imagefolder dataset:
python examples/pytorch-torchvision/main.py \
python integrations/pytorch-torchvision/main.py \
--recipe-path ~/sparseml_recipes/pruning_resnet50.yaml \
--model resnet50 \
--imagefolder-path ~/datasets/ILSVRC2012 \
Expand Down
4 changes: 2 additions & 2 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ model training, pruning, quantization, exporting, and sensitivity analysis.
These scripts natively support models in the SparseML submodules, however can be adapted for use with your own models
or used to inspire new workflows. To see examples of simple integrations with SparseML check out our
[notebooks](https://github.com/neuralmagic/sparseml/tree/main/notebooks)
and [examples](https://github.com/neuralmagic/sparseml/tree/main/examples).
and [integrations](https://github.com/neuralmagic/sparseml/tree/main/integrations).

To run one of the scripts, invoke it with a Python command from the command line along with the relevant arguments.

Expand All @@ -39,4 +39,4 @@ run any script with `-h` or `--help` to see the help printout.
| Script | Description |
|----------|-------------|
| [PyTorch Vision](https://github.com/neuralmagic/sparseml/blob/main/scripts/pytorch_vision.py) | Script for training, optimization, export, pruning sensitivity analysis, or learning rate sensitivity analysis of PyTorch classification and Detection models |
| [TensorFlow V1 Classification](https://github.com/neuralmagic/sparseml/blob/main/scripts/tensorflow_v1_classification.py) | Script for training, optimization, export, or pruning sensitivity analysis of TensorFlow V1 classification models |
| [TensorFlow V1 Classification](https://github.com/neuralmagic/sparseml/blob/main/scripts/tensorflow_v1_classification.py) | Script for training, optimization, export, or pruning sensitivity analysis of TensorFlow V1 classification models |