Moved quantization templates to openvino/tools/pot (#10814)
This commit is contained in:
parent
0b444ab2db
commit
bdc89b1571
@ -18,7 +18,7 @@ Post-training quantization is a basic feature of the POT and it has lots of knob
|
||||
quantized model. However, as a starting point we suggest using the `DefaultQuantization` algorithm with default settings.
|
||||
In many cases it leads to satisfied accuracy and performance speedup.
|
||||
|
||||
A fragment of the configuration file (`config/default_quantization_template.json` in the POT directory) with default settings is shown below:
|
||||
A fragment of the configuration file (`openvino/tools/pot/configs/templates/default_quantization_template.json` in the POT directory) with default settings is shown below:
|
||||
```
|
||||
"compression": {
|
||||
"target_device": "ANY", // Target device, the specificity of which will be taken into account during optimization.
|
||||
@ -78,7 +78,7 @@ For example, the following `range_estimator` for activations can improve the acc
|
||||
}
|
||||
```
|
||||
|
||||
Find the possible options and their description in the `config/default_quantization_spec.json` file in the POT directory.
|
||||
Find the possible options and their description in the `configs/default_quantization_spec.json` file in the POT directory.
|
||||
|
||||
4. The next option is `stat_subset_size`. It controls the size of the calibration dataset used by POT to collect statistics for quantization parameters initialization.
|
||||
It is assumed that this dataset should contain a sufficient number of representative samples. Thus, varying this parameter may affect accuracy (higher is better).
|
||||
@ -92,7 +92,7 @@ In case when the steps above do not lead to the accurate quantized model you may
|
||||
The whole idea behind that is to revert quantized layers back to floating-point precision based on their contribution to the accuracy drop until the desired accuracy degradation with respect to
|
||||
the full-precision model is satisfied.
|
||||
|
||||
A fragment of the configuration file with default settings is shown below (`configs/accuracy_aware_quantization_template.json`):
|
||||
A fragment of the configuration file with default settings is shown below (`openvino/tools/pot/configs/templates/accuracy_aware_quantization_template.json`):
|
||||
```
|
||||
"compression": {
|
||||
"target_device": "ANY", // Target device, the specificity of which will be taken into account during optimization.
|
||||
|
@ -58,7 +58,7 @@ quantization time. Default value is `False`.
|
||||
## Examples
|
||||
|
||||
A template and full specification for AccuracyAwareQuantization algorithm:
|
||||
* [Template](https://github.com/openvinotoolkit/openvino/blob/master/tools/pot/configs/accuracy_aware_quantization_template.json)
|
||||
* [Template](https://github.com/openvinotoolkit/openvino/blob/master/tools/pot/openvino/tools/pot/configs/templates/accuracy_aware_quantization_template.json)
|
||||
* [Full specification](https://github.com/openvinotoolkit/openvino/blob/master/tools/pot/configs/accuracy_aware_quantization_spec.json)
|
||||
|
||||
Example of using POT API with Accuracy-aware algorithm:
|
||||
|
@ -116,7 +116,7 @@ Enabling this option may increase compressed model accuracy, but will result in
|
||||
## Examples
|
||||
|
||||
A template and full specification for DefaultQuantization algorithm:
|
||||
* [Template](https://github.com/openvinotoolkit/openvino/blob/master/tools/pot/configs/default_quantization_template.json)
|
||||
* [Template](https://github.com/openvinotoolkit/openvino/blob/master/tools/pot/openvino/tools/pot/configs/templates/default_quantization_template.json)
|
||||
* [Full specification](https://github.com/openvinotoolkit/openvino/blob/master/tools/pot/configs/default_quantization_spec.json)
|
||||
|
||||
Command-line example:
|
||||
|
@ -76,7 +76,7 @@ def _create_log_path(config):
|
||||
|
||||
|
||||
def _update_config_path(args):
|
||||
config_template_folder = os.path.join(Path(__file__).parents[4], 'configs')
|
||||
config_template_folder = os.path.join(Path(__file__).parents[1], 'configs', 'templates')
|
||||
|
||||
if args.quantize is not None:
|
||||
if args.quantize == 'default':
|
||||
|
@ -0,0 +1,2 @@
|
||||
# Copyright (C) 2022 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
@ -25,11 +25,6 @@ class InstallCmd(install):
|
||||
# install requires
|
||||
self.do_egg_install()
|
||||
|
||||
def_quant_path = os.path.join("configs", "default_quantization_template.json")
|
||||
aa_quant_path = os.path.join("configs", "accuracy_aware_quantization_template.json")
|
||||
copyfile(def_quant_path, os.path.join(self.install_purelib, prefix, "pot", def_quant_path))
|
||||
copyfile(aa_quant_path, os.path.join(self.install_purelib, prefix, "pot", aa_quant_path))
|
||||
|
||||
version_txt = os.path.join(prefix, "pot", "version.txt")
|
||||
if os.path.exists(version_txt):
|
||||
copyfile(os.path.join(version_txt),
|
||||
@ -143,8 +138,9 @@ setup(
|
||||
url='https://software.intel.com/openvino-toolkit',
|
||||
packages=find_packages(exclude=["tests", "tests.*",
|
||||
"tools", "tools.*"]),
|
||||
package_data={"openvino.tools.pot.configs.hardware": ['*.json'],
|
||||
"openvino.tools.pot.api.samples": ['*.md', '*/*.md']},
|
||||
package_data={'openvino.tools.pot.configs.hardware': ['*.json'],
|
||||
'openvino.tools.pot.api.samples': ['*.md', '*/*.md'],
|
||||
'openvino.tools.pot.configs.templates': ['*.json']},
|
||||
include_package_data=True,
|
||||
cmdclass={
|
||||
'install': InstallCmd,
|
||||
|
Loading…
Reference in New Issue
Block a user