Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Commit b6239b2

Browse files
Docs 1.0 refactor rs2 (#93)
* Updated pages to have links back to instruction pages; cleaned up a few broken links * Update custom-integrations.mdx * Update custom-integrations.mdx * Update install.mdx * Update deepsparse.mdx * Update deploying.mdx * Update deploying.mdx * Update deploying.mdx * Update deploying.mdx * Update deploying.mdx * Update benchmarking.mdx * Update custom-integrations.mdx * Update custom-integrations.mdx Fixes https://app.asana.com/0/1203146234476221/1203094643835125/f
1 parent 79b2c7c commit b6239b2

29 files changed

+215
-166
lines changed

src/content/details/faqs.mdx

Lines changed: 92 additions & 35 deletions
Large diffs are not rendered by default.

src/content/get-started/deploy-a-model/cv-object-detection.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ The DeepSparse Server is a server wrapper around `Pipelines`, including the obje
1414
the server provides and HTTP interface that accepts images and image files as inputs and outputs the labeled predictions.
1515
With all of this built on top of the DeepSparse Engine, the simplicity of servable pipelines is combined with GPU-class performance on CPUs for sparse models.
1616

17+
## Install Requirements
18+
19+
This example requires [DeepSparse Server+YOLO Install](/get-started/install/deepsparse).
20+
1721
## Start the Server
1822

1923
Before starting the server, the model must be set up in the format expected for DeepSparse `Pipelines`.

src/content/get-started/deploy-a-model/nlp-text-classification.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ The DeepSparse Server is a server wrapper around `Pipelines`, including the sent
1414
the server provides an HTTP interface that accepts raw text sequences as inputs and responds with the labeled predictions.
1515
With all of this built on top of the DeepSparse Engine, the simplicity of servable pipelines is combined with GPU-class performance on CPUs for sparse models.
1616

17+
## Install Requirements
18+
19+
This example requires [DeepSparse Server Install](/get-started/install/deepsparse).
20+
1721
## Start the Server
1822

1923
Before starting the server, the model must be set up in the format expected for DeepSparse `Pipelines`.

src/content/get-started/install.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ It is recommended to install in a [virtual environment](https://docs.python.org/
1717
To begin using the Deep Sparse Platform, run the following commands which install standard setups for deployment with [DeepSparse](../../products/deepsparse) and model training/optimization with [SparseML](../../products/sparseml):
1818

1919
```bash
20-
pip install deepsparse[server] sparseml[torchvision]
20+
pip install deepsparse[server] sparseml[torch, torchvision]
2121
```
2222

2323
## Installable Packages

src/content/get-started/install/deepsparse.mdx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ index: 1000
88

99
# DeepSparse Installation
1010

11-
The [DeepSparse Engine](../../products/deepsparse) enables GPU-class performance on CPUs, leveraging sparsity within models to reduce FLOPs and the unique cache hierarchy on CPUs to reduce memory movement.
11+
The [DeepSparse Engine](/products/deepsparse) enables GPU-class performance on CPUs, leveraging sparsity within models to reduce FLOPs and the unique cache hierarchy on CPUs to reduce memory movement.
1212
The engine accepts models in the open-source [ONNX format](https://onnx.ai/), which are easily created from PyTorch and TensorFlow models.
1313

1414
Currently, DeepSparse is tested on Python 3.7-3.9, ONNX 1.5.0-1.10.1, ONNX opset version 11+ and is [manylinux compliant](https://peps.python.org/pep-0513/).
15-
It is limited to [Linux systems](https://www.linux.org/) running on [X86 CPU architectures](https://en.wikipedia.org/wiki/X86).
15+
It is limited to Linux systems running on x86 CPU architectures.
1616

1717
## General Install
1818

@@ -24,7 +24,7 @@ pip install deepsparse
2424

2525
## Server Install
2626

27-
The [DeepSparse Server](../../use-cases/deploying-with-deepsparse/deepsparse-server) allows you to serve models and pipelines through an HTTP interface using the deepsparse.server CLI.
27+
The [DeepSparse Server](/use-cases/deploying-deepsparse/deepsparse-server) allows you to serve models and pipelines through an HTTP interface using the deepsparse.server CLI.
2828
To install, use the following extra option:
2929

3030
```bash
@@ -33,9 +33,10 @@ pip install deepsparse[server]
3333

3434
## YOLO Install
3535

36-
The [Ultralytics YOLOv5](../../use-cases/ultralytics-yolov5) models require extra dependencies for deployment.
36+
The [Ultralytics YOLOv5](/use-cases/object-detection/deploying) models require extra dependencies for deployment.
3737
To use YOLO models, install with the following extra option:
3838

3939
```bash
40-
pip install deepsparse[yolo]
40+
pip install deepsparse[yolo] # just yolo requirements
41+
pip install deepsparse[yolo, server] # both yolo + server requirements
4142
```

src/content/get-started/install/sparseml.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ index: 2000
1010

1111
[SparseML](/products/sparseml) enables you to create sparse models trained on your data. It supports transfer learning from sparse models to new data and sparsifying dense models from scratch with state-of-the-art algorithms for pruning and quantization.
1212

13-
Currently, SparseML is tested on Python 3.7-3.9 and is limited to [Linux](https://www.linux.org/) and [MacOS](https://www.apple.com/mac/) systems.
13+
Currently, SparseML is tested on Python 3.7-3.9 and is limited to Linux and MacOS systems.
1414

1515
## General Install
1616

src/content/get-started/sparsify-a-model/custom-integrations.mdx

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ In addition to supported integrations described on the prior page, SparseML is s
1515
This flexibility enables easy sparsification for any neural network architecture for custom models and use cases. Once SparseML is installed,
1616
the necessary code can be plugged into most PyTorch/Keras training pipelines with only a few lines of code.
1717

18+
## Install Requirements
19+
20+
This section requires [SparseML Torchvision Install](/get-started/install/sparseml) to run the Apply the Recipe section.
21+
1822
## Integrate SparseML
1923

2024
To enable sparsification of models with recipes, a few edits to the training pipeline code need to be made.
@@ -41,19 +45,19 @@ A wrapped instance of the training optimizer is returned.
4145

4246
A simple training example utilizing PyTorch and Torchvision with this SparseML integration is provided below:
4347
```Python
44-
from torchvision.models import resnet50
48+
import torch
4549
from torch.nn import Linear
4650
from torch.utils.data import DataLoader
4751
from torch.nn import CrossEntropyLoss
4852
from torch.optim import SGD
4953

54+
from sparseml.pytorch.models import resnet50
5055
from sparseml.pytorch.datasets import ImagenetteDataset, ImagenetteSize
5156
from sparseml.pytorch.optim import ScheduledModifierManager
5257

5358
# Model creation
54-
model = resnet50(pretrained=True)
5559
NUM_CLASSES = 10 # number of imagenette classes
56-
model.fc = Linear(in_features=model.fc.in_features, out_features=NUM_CLASSES, bias=True)
60+
model = resnet50(pretrained=True, num_classes=NUM_CLASSES)
5761

5862
# Dataset creation
5963
batch_size = 64
@@ -68,18 +72,24 @@ model.to(device)
6872
criterion = CrossEntropyLoss()
6973
optimizer = SGD(model.parameters(), lr=10e-6, momentum=0.9)
7074

75+
# Recipe - in this case, we pull down a recipe from the SparseZoo for ResNet50
76+
# This can be a be a path to a local file
77+
recipe_path = "zoo:cv/classification/resnet_v1-50/pytorch/sparseml/imagenet/pruned95_quant-none?recipe_type=original"
78+
7179
# SparseML Integration
7280
manager = ScheduledModifierManager.from_yaml(recipe_path)
7381
optimizer = manager.modify(model, optimizer, steps_per_epoch=len(train_loader))
7482

7583
# Training Loop
7684
for epoch in range(manager.max_epochs):
77-
for inputs, labels in dataloaders[phase]:
85+
running_loss = 0.0
86+
running_corrects = 0.0
87+
for inputs, labels in train_loader:
7888
inputs = inputs.to(device)
7989
labels = labels.to(device)
8090
optimizer.zero_grad()
81-
with torch.set_grad_enabled(true):
82-
outputs = model(inputs)
91+
with torch.set_grad_enabled(True):
92+
outputs, _ = model(inputs)
8393
loss = criterion(outputs, labels)
8494
_, preds = torch.max(outputs, 1)
8595
loss.backward()
@@ -123,8 +133,7 @@ modifiers:
123133

124134
- !QuantizationModifier
125135
start_epoch: 50.0
126-
submodules: ['model']
127-
freeze_bn_stats_epoch: 3.0
136+
freeze_bn_stats_epoch: 53.0
128137

129138
- !SetLearningRateModifier
130139
start_epoch: 50.0

src/content/get-started/sparsify-a-model/supported-integrations.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ SparseML has pre-made integrations with many popular model repositories, such as
1414
For these integrations, a sparsification recipe is all you need, and you can apply state-of-the-art sparsification algorithms, including
1515
pruning, distillation, and quantization, with a single command line call.
1616

17+
## Install Requirements
18+
19+
This section requires [SparseML Torchvision Install](/get-started/install/sparseml) to run the Apply the Recipe section.
20+
1721
## Pruning and Pruning Recipes
1822

1923
Pruning is a systematic way of removing redundant weights and connections within a neural network. An applied pruning algorithm must determine which

src/content/get-started/transfer-a-sparsified-model/cv-object-detection.mdx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ This page walks through an example of fine-tuning a pre-sparsified model from th
1212

1313
We will use SparseZoo to pull down a pre-sparsified YOLOv5l and will use SparseML to fine-tune onto the VOC dataset while preserving sparsity.
1414

15-
Make sure you install SparseML with torchvision before getting started:
16-
```bash
17-
pip install sparseml[torchvision]
18-
```
15+
## Install Requirements
16+
17+
This example requires [SparseML Torchvision Install](/get-started/install/sparseml).
1918

2019
## Transfer Learning
2120

src/content/get-started/transfer-a-sparsified-model/nlp-text-classification.mdx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@ If you already have a trained teacher model ready to go, you can skip step 1.
1919

2020
An example of transfer learning without model distillation is in the [Use Cases Page](/use-cases/natural-language-processing/text-classification).
2121

22-
Make sure you install SparseML before getting started:
23-
```bash
24-
pip install sparseml
25-
```
22+
## Install Requirements
23+
24+
This example requires [SparseML General Install](/get-started/install/sparseml).
2625

2726
## Train a Teacher
2827

0 commit comments

Comments
 (0)