Skip to content

Commit

Permalink
Update QuickStart.md (microsoft#2884)
Browse files Browse the repository at this point in the history
  • Loading branch information
linbinskn authored Sep 14, 2020
1 parent ebca3ce commit bc71a0d
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions docs/en_US/Compressor/QuickStart.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ It means following the algorithm's default setting for compressed operations wit

#### Quantization specific keys

**If you use quantization algorithms, you need to specify more keys. If you use pruning algorithms, you can safely skip these keys**
Besides the keys explained above, if you use quantization algorithms you need to specify more keys in `config_list`, which are explained below.

* __quant_types__ : list of string.

Expand All @@ -148,6 +148,31 @@ when the value is int type, all quantization types share same bits length. eg.
}
```

The following example shows a more complete `config_list`, it uses `op_names` (or `op_types`) to specify the target layers along with the quantization bits for those layers.
```
configure_list = [{
'quant_types': ['weight'],
'quant_bits': 8,
'op_names': ['conv1']
}, {
'quant_types': ['weight'],
'quant_bits': 4,
'quant_start_step': 0,
'op_names': ['conv2']
}, {
'quant_types': ['weight'],
'quant_bits': 3,
'op_names': ['fc1']
},
{
'quant_types': ['weight'],
'quant_bits': 2,
'op_names': ['fc2']
}
]
```
In this example, 'op_names' is the name of layer and four layers will be quantized to different quant_bits.

### APIs for Updating Fine Tuning Status

Some compression algorithms use epochs to control the progress of compression (e.g. [AGP](https://nni.readthedocs.io/en/latest/Compressor/Pruner.html#agp-pruner)), and some algorithms need to do something after every minibatch. Therefore, we provide another two APIs for users to invoke: `pruner.update_epoch(epoch)` and `pruner.step()`.
Expand All @@ -168,4 +193,4 @@ pruner.export_model(model_path='model.pth')
pruner.export_model(model_path='model.pth', mask_path='mask.pth', onnx_path='model.onnx', input_shape=[1, 1, 28, 28])
```

If you want to really speed up the compressed model, please refer to [NNI model speedup](./ModelSpeedup.md) for details.
If you want to really speed up the compressed model, please refer to [NNI model speedup](./ModelSpeedup.md) for details.

0 comments on commit bc71a0d

Please sign in to comment.