-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add quantized model export description #3192
Conversation
@@ -194,8 +194,8 @@ Some compression algorithms use epochs to control the progress of compression (e | |||
|
|||
``update_epoch`` should be invoked in every epoch, while ``step`` should be invoked after each minibatch. Note that most algorithms do not require calling the two APIs. Please refer to each algorithm's document for details. For the algorithms that do not need them, calling them is allowed but has no effect. | |||
|
|||
Export Compressed Model | |||
^^^^^^^^^^^^^^^^^^^^^^^ | |||
Export Pruning Model |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pruning -> Pruned
@@ -209,4 +209,27 @@ You can easily export the compressed model using the following API if you are pr | |||
|
|||
pruner.export_model(model_path='model.pth', mask_path='mask.pth', onnx_path='model.onnx', input_shape=[1, 1, 28, 28]) | |||
|
|||
Export Quantized Model | |||
^^^^^^^^^^^^^^^^^^^^^^ | |||
You can export the quantized model directly by using ``torch.save`` api and the quantized model can be loaded by ``torch.load`` without any extra modification. The following example shows the normal proceduce of saving, loading quantized model and get related parameters in QAT. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
proceduce -> procedure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, fixed.
Export Compressed Model | ||
^^^^^^^^^^^^^^^^^^^^^^^ | ||
Export Pruned Model | ||
^^^^^^^^^^^^^^^^^^^^ | ||
|
||
You can easily export the compressed model using the following API if you are pruning your model, ``state_dict`` of the sparse model weights will be stored in ``model.pth``\ , which can be loaded by ``torch.load('model.pth')``. In this exported ``model.pth``\ , the masked weights are zero. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can easily export the compressed model
-> You can easily export the pruned model
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK.
No description provided.