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
* [ao] fixing tutorials
Summary: fixing tutorial to have example_inputs and QConfigMapping
Test Plan: for fx_graph_mode_ptq_static.rst and
fx_graph_mode_ptq_dynamic.py I pasted and ran the script to verify that it ran, the
latter could be run exactly while the former required a slight
modification since I didn't had a different version of the imagenet
dataset but only the dataloaders had to be modified.
for the quant_guide no explicit testing was done
Reviewers:
Subscribers:
Tasks:
Tags:
ghstack-source-id: d142b2f
Pull Request resolved: #2137
* Fix typo "tesors" (#2138)
* [ao] fixing tutorials
Summary: fixing tutorial to have example_inputs and QConfigMapping
Test Plan: for fx_graph_mode_ptq_static.rst and
fx_graph_mode_ptq_dynamic.py I pasted and ran the script to verify that it ran, the
latter could be run exactly while the former required a slight
modification since I didn't had a different version of the imagenet
dataset but only the dataloaders had to be modified.
for the quant_guide no explicit testing was done
Reviewers:
Subscribers:
Tasks:
Tags:
ghstack-source-id: d142b2f
Pull Request resolved: #2137
Co-authored-by: Svetlana Karslioglu <svekars@fb.com>
Co-authored-by: Alex Triapitsyn <atryapa@gmail.com>
This tutorial introduces the steps to do post training dynamic quantization in graph mode based on ``torch.fx``.
7
+
This tutorial introduces the steps to do post training dynamic quantization in graph mode based on ``torch.fx``.
8
8
We have a separate tutorial for `FX Graph Mode Post Training Static Quantization <https://pytorch.org/tutorials/prototype/fx_graph_mode_ptq_static.html>`_,
9
9
comparison between FX Graph Mode Quantization and Eager Mode Quantization can be found in the `quantization docs <https://pytorch.org/docs/master/quantization.html#quantization-api-summary>`_
10
10
@@ -13,20 +13,20 @@
13
13
.. code:: python
14
14
15
15
import torch
16
-
from torch.quantization import default_dynamic_qconfig
17
-
# Note that this is temporary, we'll expose these functions to torch.quantization after official releasee
16
+
from torch.ao.quantization import default_dynamic_qconfig, QConfigMapping
17
+
# Note that this is temporary, we'll expose these functions to torch.ao.quantization after official releasee
18
18
from torch.quantization.quantize_fx import prepare_fx, convert_fx
19
19
20
20
float_model.eval()
21
21
qconfig = get_default_qconfig("fbgemm")
22
-
qconfig_dict = {"": qconfig}
23
-
prepared_model = prepare_fx(float_model, qconfig_dict) # fuse modules and insert observers
# no calibration is required for dynamic quantization
25
25
quantized_model = convert_fx(prepared_model) # convert the model to a dynamically quantized model
26
26
27
-
In this tutorial, we’ll apply dynamic quantization to an LSTM-based next word-prediction model,
28
-
closely following the word language model from the PyTorch examples.
29
-
We will copy the code from `Dynamic Quantization on an LSTM Word Language Model <https://pytorch.org/tutorials/advanced/dynamic_quantization_tutorial.html>`_
27
+
In this tutorial, we’ll apply dynamic quantization to an LSTM-based next word-prediction model,
28
+
closely following the word language model from the PyTorch examples.
29
+
We will copy the code from `Dynamic Quantization on an LSTM Word Language Model <https://pytorch.org/tutorials/advanced/dynamic_quantization_tutorial.html>`_
30
30
and omit the descriptions.
31
31
32
32
"""
@@ -36,20 +36,20 @@
36
36
# 1. Define the Model, Download Data and Model
37
37
# --------------------------------------------
38
38
#
39
-
# Download the `data <https://s3.amazonaws.com/research.metamind.io/wikitext/wikitext-2-v1.zip>`_
39
+
# Download the `data <https://s3.amazonaws.com/research.metamind.io/wikitext/wikitext-2-v1.zip>`_
# Full docs for supported qconfig for floating point modules/ops can be found in `quantization docs <https://pytorch.org/docs/stable/quantization.html#module-torch.quantization>`_
235
+
# Full docs for `QConfigMapping <https://pytorch.org/docs/stable/generated/torch.ao.quantization.qconfig_mapping.QConfigMapping.html#torch.ao.quantization.qconfig_mapping.QConfigMapping>`_
0 commit comments