Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Add quantized model export description #3192

Merged
merged 5 commits into from
Dec 25, 2020
Merged

Conversation

linbinskn
Copy link
Contributor

No description provided.

@liuzhe-lz liuzhe-lz changed the base branch from master to v2.0 December 21, 2020 05:39
@@ -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
Copy link
Contributor

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

proceduce -> procedure

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, fixed.

@QuanluZhang QuanluZhang requested a review from J-shang December 23, 2020 03:26
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.
Copy link
Contributor

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 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK.

@linbinskn linbinskn requested a review from J-shang December 23, 2020 06:30
@QuanluZhang QuanluZhang merged commit cc58a81 into microsoft:v2.0 Dec 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants