Skip to content

Commit 2d9ff95

Browse files
Refactoring XQuant_Extension_Tool Documents (#1646)
* refactoring XQuant_Extension_Tool.rst
1 parent ef85725 commit 2d9ff95

File tree

20 files changed

+246
-565
lines changed

20 files changed

+246
-565
lines changed

docs/_sources/guidelines/XQuant_Extension_Tool.rst.txt

Lines changed: 54 additions & 166 deletions
Large diffs are not rendered by default.

docs/docs_troubleshoot/_sources/index.rst.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. _ug-index:
22

33
========================================================================================
4-
TroubleShooting Documentation (MCT XQuant Extension Tool)
4+
TroubleShooting Manual (MCT XQuant Extension Tool)
55
========================================================================================
66

77

@@ -12,8 +12,9 @@ The Model Compression Toolkit (MCT) offers numerous functionalities to compress
1212

1313
Outlined below are a series of steps aimed at recovering lost accuracy resulting from compression with MCT. Some steps may be applicable to your model, while others may not.
1414

15+
For overview of XQuant Extension Tool, see `About XQuant Extension Tool <https://sonysemiconductorsolutions.github.io/mct-model-optimization/guidelines/XQuant_Extension_Tool.html>`_ [1].
1516

16-
Quantization Troubleshooting for MCT[1]
17+
Quantization Troubleshooting for MCT
1718
============================================
1819

1920
**1. Judgeable Troubleshoots**
@@ -48,6 +49,4 @@ If quantization accuracy of your model does not improve after reading Judgeable
4849

4950
References
5051
============================================
51-
[1] `Quantization Troubleshooting for MCT <https://github.com/SonySemiconductorSolutions/mct-model-optimization/tree/main/quantization_troubleshooting.md>`_
52-
53-
[2] `PyTorch documentation (v2.5) <https://docs.pytorch.org/docs/2.5/index.html>`_
52+
[1] `XQuant Extension (MCT Document) <https://sonysemiconductorsolutions.github.io/mct-model-optimization/guidelines/XQuant_Extension_Tool.html>`_

docs/docs_troubleshoot/_sources/troubleshoots/outlier_removal.rst.txt

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Such outliers can mess up the selection of quantization parameters.
1515

1616
Trouble Situation
1717
==============================
18-
The quantization accuracy may degrade when there are outlier activations in the quantized layers of your model.
18+
The quantization accuracy may degrade when there are outliers (activation values far from the average activation of representative dataset) in the quantized layers of your model.
1919

2020
For example, you can check if activation tensors have outliers by visualizing the histograms in TensorBoard(**thresholds_selection** in the below image).
2121

@@ -32,3 +32,22 @@ Set ``z_threshold`` to a value. Typical value range is between 5.0 and 20.0.
3232
3333
core_config = mct.core.CoreConfig(mct.core.QuantizationConfig(z_threshold=8.0))
3434
quantized_model, _ = mct.ptq.pytorch_post_training_quantization(..., core_config=core_config)
35+
36+
Appendix: How to Read the Outlier Histograms
37+
=======================================================
38+
After execution XQuant Extension Tool, it makes the histograms for the degraded layers containing the detected outliers.
39+
The histograms are saved in a directory named “outlier_histgrams” created in the path specified in XQuantConfig.report_dir.
40+
41+
.. image:: ../images/outlier.png
42+
43+
* **First X-axis(lower part)**: Indicates bins that finely divide the range of data values.
44+
* **Second X-axis(upper part)**: Shows the z-score values corresponding to the primary X-axis.
45+
* **Red dashed line**: The z-score threshold set in XQuantConfig.
46+
* **Black dashed line**
47+
48+
* **Lower zscore**: Indicates the maximum value on the lower side of the histogram.
49+
* **Upper zscore**: Indicates the maximum value on the upper side of the histogram.
50+
51+
An example of a histogram detected by Outlier Removal is shown.
52+
In this example, outliers appear in the range from about 3.9 to 5.3 on the lower end of the z-score.
53+
Therefore, setting the z-score threshold to 3.9 will allow these outliers to be removed.

docs/docs_troubleshoot/_sources/troubleshoots/shift_negative_activation.rst.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@ The quantization accuracy may degrade when your model contains the following lay
2323
* torch.nn.SiLU / torch.nn.functional.silu
2424
* torch.nn.GELU / torch.nn.functional.gelu
2525

26-
Example: `PReLU <https://docs.pytorch.org/docs/2.5/generated/torch.nn.PReLU.html>`_ [2]
27-
28-
29-
.. image:: ../images/PReLU.png
30-
:scale: 40%
31-
3226
Solution
3327
=================================
3428
Shifting negative values to positive values can improve quantization error (saving an extra 1bit).
-26.8 KB
Binary file not shown.

docs/docs_troubleshoot/index.html

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<meta charset="utf-8" />
77
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
88

9-
<title>TroubleShooting Documentation (MCT XQuant Extension Tool) &#8212; TroubleShooting Documentation (MCT XQuant Extension Tool): ver 1.0</title>
9+
<title>TroubleShooting Manual (MCT XQuant Extension Tool) &#8212; TroubleShooting Documentation (MCT XQuant Extension Tool): ver 1.0</title>
1010
<link rel="stylesheet" type="text/css" href="static/pygments.css?v=03e43079" />
1111
<link rel="stylesheet" type="text/css" href="static/bizstyle.css?v=5283bb3d" />
1212
<link rel="stylesheet" type="text/css" href="static/css/custom.css?v=01243f34" />
@@ -29,7 +29,7 @@ <h3>Navigation</h3>
2929
<a href="genindex.html" title="General Index"
3030
accesskey="I">index</a></li>
3131
<li class="nav-item nav-item-0"><a href="#">TroubleShooting Documentation (MCT XQuant Extension Tool): ver 1.0</a> &#187;</li>
32-
<li class="nav-item nav-item-this"><a href="">TroubleShooting Documentation (MCT XQuant Extension Tool)</a></li>
32+
<li class="nav-item nav-item-this"><a href="">TroubleShooting Manual (MCT XQuant Extension Tool)</a></li>
3333
</ul>
3434
</div>
3535

@@ -38,15 +38,16 @@ <h3>Navigation</h3>
3838
<div class="bodywrapper">
3939
<div class="body" role="main">
4040

41-
<section id="troubleshooting-documentation-mct-xquant-extension-tool">
42-
<span id="ug-index"></span><h1>TroubleShooting Documentation (MCT XQuant Extension Tool)<a class="headerlink" href="#troubleshooting-documentation-mct-xquant-extension-tool" title="Link to this heading"></a></h1>
41+
<section id="troubleshooting-manual-mct-xquant-extension-tool">
42+
<span id="ug-index"></span><h1>TroubleShooting Manual (MCT XQuant Extension Tool)<a class="headerlink" href="#troubleshooting-manual-mct-xquant-extension-tool" title="Link to this heading"></a></h1>
4343
<section id="overview">
4444
<h2>Overview<a class="headerlink" href="#overview" title="Link to this heading"></a></h2>
4545
<p>The Model Compression Toolkit (MCT) offers numerous functionalities to compress neural networks with minimal accuracy lost. However, in some cases, the compressed model may experience a significant decrease in accuracy. Fear not, as this lost accuracy can often be reclaimed by adjusting the quantization configuration or setup.</p>
4646
<p>Outlined below are a series of steps aimed at recovering lost accuracy resulting from compression with MCT. Some steps may be applicable to your model, while others may not.</p>
47+
<p>For overview of XQuant Extension Tool, see <a class="reference external" href="https://sonysemiconductorsolutions.github.io/mct-model-optimization/guidelines/XQuant_Extension_Tool.html">About XQuant Extension Tool</a> [1].</p>
4748
</section>
48-
<section id="quantization-troubleshooting-for-mct-1">
49-
<h2>Quantization Troubleshooting for MCT[1]<a class="headerlink" href="#quantization-troubleshooting-for-mct-1" title="Link to this heading"></a></h2>
49+
<section id="quantization-troubleshooting-for-mct">
50+
<h2>Quantization Troubleshooting for MCT<a class="headerlink" href="#quantization-troubleshooting-for-mct" title="Link to this heading"></a></h2>
5051
<p><strong>1. Judgeable Troubleshoots</strong></p>
5152
<p>The following items are automatically identified by the XQuant Extension Tool.</p>
5253
<p>Please read the following items indicated by XQuant Extension Tool, especially the <strong>Solution</strong> section.</p>
@@ -76,8 +77,7 @@ <h2>Quantization Troubleshooting for MCT[1]<a class="headerlink" href="#quantiza
7677
</section>
7778
<section id="references">
7879
<h2>References<a class="headerlink" href="#references" title="Link to this heading"></a></h2>
79-
<p>[1] <a class="reference external" href="https://github.com/SonySemiconductorSolutions/mct-model-optimization/tree/main/quantization_troubleshooting.md">Quantization Troubleshooting for MCT</a></p>
80-
<p>[2] <a class="reference external" href="https://docs.pytorch.org/docs/2.5/index.html">PyTorch documentation (v2.5)</a></p>
80+
<p>[1] <a class="reference external" href="https://sonysemiconductorsolutions.github.io/mct-model-optimization/guidelines/XQuant_Extension_Tool.html">XQuant Extension (MCT Document)</a></p>
8181
</section>
8282
</section>
8383

@@ -91,9 +91,9 @@ <h2>References<a class="headerlink" href="#references" title="Link to this headi
9191
<div>
9292
<h3><a href="#">Table of Contents</a></h3>
9393
<ul>
94-
<li><a class="reference internal" href="#">TroubleShooting Documentation (MCT XQuant Extension Tool)</a><ul>
94+
<li><a class="reference internal" href="#">TroubleShooting Manual (MCT XQuant Extension Tool)</a><ul>
9595
<li><a class="reference internal" href="#overview">Overview</a></li>
96-
<li><a class="reference internal" href="#quantization-troubleshooting-for-mct-1">Quantization Troubleshooting for MCT[1]</a></li>
96+
<li><a class="reference internal" href="#quantization-troubleshooting-for-mct">Quantization Troubleshooting for MCT</a></li>
9797
<li><a class="reference internal" href="#references">References</a></li>
9898
</ul>
9999
</li>
@@ -121,7 +121,7 @@ <h3>Navigation</h3>
121121
<a href="genindex.html" title="General Index"
122122
>index</a></li>
123123
<li class="nav-item nav-item-0"><a href="#">TroubleShooting Documentation (MCT XQuant Extension Tool): ver 1.0</a> &#187;</li>
124-
<li class="nav-item nav-item-this"><a href="">TroubleShooting Documentation (MCT XQuant Extension Tool)</a></li>
124+
<li class="nav-item nav-item-this"><a href="">TroubleShooting Manual (MCT XQuant Extension Tool)</a></li>
125125
</ul>
126126
</div>
127127
<div class="footer" role="contentinfo">

docs/docs_troubleshoot/objects.inv

52 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)