You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: prototype_source/pt2e_quant_ptq_static.rst
+4-1Lines changed: 4 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -302,12 +302,13 @@ For post training quantization, we'll need to set model to the eval mode.
302
302
``Quantizer`` is backend specific, and each ``Quantizer`` will provide their own way to allow users to configure their model. Just as an example, here is the different configuration APIs supported by XNNPackQuantizer:
303
303
304
304
.. code:: python
305
+
305
306
quantizer.set_global(qconfig_opt) # qconfig_opt is an optional qconfig, either a valid qconfig or None
306
307
.set_object_type(torch.nn.Conv2d, qconfig_opt) # can be a module type
307
308
.set_object_type(torch.nn.functional.linear, qconfig_opt) # or torch functional op
308
309
.set_module_name("foo.bar", qconfig_opt)
309
310
310
-
We have another `tutorial <https://pytorch.org/tutorials/prototype/quantization_in_pytorch_2_0_export_tutorial.html>`_ that talks about how to write a new ``Quantizer``.
311
+
We have another `tutorial <https://pytorch.org/tutorials/prototype/pt2e_quantizer.html>`_ that talks about how to write a new ``Quantizer``.
311
312
312
313
6. Prepare the Model for Post Training Static Quantization
@@ -434,6 +436,7 @@ We'll show how to save and load the quantized model.
434
436
435
437
11. Debugging Quantized Model
436
438
----------------------------
439
+
437
440
We have `Numeric Suite <https://pytorch.org/docs/stable/quantization-accuracy-debugging.html#numerical-debugging-tooling-prototype>`_ that can help with debugging in eager mode and FX graph mode. The new version of Numeric Suite working with PyTorch 2.0 Export models is still in development.
Copy file name to clipboardExpand all lines: prototype_source/pt2e_quantizer.rst
+7-3Lines changed: 7 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -10,12 +10,16 @@ Prerequisites:
10
10
11
11
Required:
12
12
- `Torchdynamo concepts in PyTorch <https://pytorch.org/docs/stable/dynamo/index.html>`__
13
+
13
14
- `Quantization concepts in PyTorch <https://pytorch.org/docs/master/quantization.html#quantization-api-summary>`__
15
+
14
16
- `(prototype) PyTorch 2.0 Export Post Training Static Quantization <https://pytorch.org/tutorials/prototype/pt2e_quant_ptq_static.html>`__
15
17
16
18
Optional:
17
19
- `FX Graph Mode post training static quantization <https://pytorch.org/tutorials/prototype/fx_graph_mode_ptq_static.html>`__
20
+
18
21
- `BackendConfig in PyTorch Quantization FX Graph Mode <https://pytorch.org/tutorials/prototype/backend_config_tutorial.html?highlight=backend>`__
22
+
19
23
- `QConfig and QConfigMapping in PyTorch Quantization FX Graph Mode <https://pytorch.org/tutorials/prototype/backend_config_tutorial.html#set-up-qconfigmapping-that-satisfies-the-backend-constraints>`__
20
24
21
25
Introduction
@@ -25,12 +29,12 @@ Introduction
25
29
(1). What is supported quantized operator or patterns in the backend
26
30
(2). How can users express the way they want their floating point model to be quantized, for example, quantized the whole model to be int8 symmetric quantization, or quantize only linear layers etc.
27
31
28
-
Please see `here <https://pytorch.org/tutorials/prototype/pt2e_quant_ptq_static.html>`__ For motivations for ``Quantizer``.
32
+
Please see `here <https://pytorch.org/tutorials/prototype/pt2e_quant_ptq_static.html#motivation-of-pytorch-2-0-export-quantization>`__ For motivations for the new API and ``Quantizer``.
29
33
30
34
An existing quantizer object defined for ``XNNPACK`` is in
``Quantizer`` uses annotation API to convey quantization intent for different operators/patterns.
@@ -269,4 +273,4 @@ Conclusion
269
273
With this tutorial, we introduce the new quantization path in PyTorch 2.0. Users can learn about
270
274
how to define a ``BackendQuantizer`` with the ``QuantizationAnnotation API`` and integrate it into the quantization 2.0 flow.
271
275
Examples of ``QuantizationSpec``, ``SharedQuantizationSpec``, ``FixedQParamsQuantizationSpec``, and ``DerivedQuantizationSpec``
272
-
are given for specific annotation use case. This is a prerequisite to be able to quantize a model in PyTorch 2.0 Export Quantization flow. Please follow `this tutorial <https://pytorch.org/tutorials/prototype/pt2e_quant_ptq_static.html>`_ to actually quantize a model.
276
+
are given for specific annotation use case. This is a prerequisite to be able to quantize a model in PyTorch 2.0 Export Quantization flow. You can use `XNNPACKQuantizer <https://github.com/pytorch/pytorch/blob/main/torch/ao/quantization/quantizer/xnnpack_quantizer.py>`_ as an example to start implementing your own ``Quantizer``. After that please follow `this tutorial <https://pytorch.org/tutorials/prototype/pt2e_quant_ptq_static.html>`_ to actually quantize your model.
0 commit comments