-
- Downloads
image_classifier.py: PTQ stats collection and eval in same run (#346)
* Previous implementation: * Stats collection required a separate run with `-qe-calibration`. * Specifying `--quantize-eval` without `--qe-stats-file` triggered dynamic quantization. * Running with `--quantize-eval --qe-calibration <num>` only ran stats collection and ignored --quantize-eval. * New implementation: * Running `--quantize-eval --qe-calibration <num>` will now perform stats collection according to the calibration flag, and then quantize the model with the collected stats (and run evaluation). * Specifying `--quantize-eval` without `--qe-stats-file` will trigger the same flow as in the bullet above, as if `--qe-calibration 0.05` was used (i.e. 5% of the test set will be used for stats). * Added new flag: `--qe-dynamic`. From now, to do dynamic quantization, need to explicitly run: `--quantize-eval --qe-dynamic` * As before, can still run `--qe-calibration` without `--quantize-eval` to perform "stand-alone" stats collection * The following flags, which all represent different ways to control creation of stats or use of existing stats, are now mutually exclusive: `--qe-calibration`, `-qe-stats-file`, `--qe-dynamic`, `--qe-config-file`
Showing
- distiller/apputils/image_classifier.py 77 additions, 27 deletionsdistiller/apputils/image_classifier.py
- distiller/data_loggers/collector.py 10 additions, 2 deletionsdistiller/data_loggers/collector.py
- distiller/quantization/range_linear.py 12 additions, 11 deletionsdistiller/quantization/range_linear.py
- distiller/utils.py 12 additions, 0 deletionsdistiller/utils.py
- examples/classifier_compression/compress_classifier.py 4 additions, 4 deletionsexamples/classifier_compression/compress_classifier.py
- requirements.txt 1 addition, 1 deletionrequirements.txt
- tests/full_flow_tests.py 1 addition, 1 deletiontests/full_flow_tests.py
Loading
Please register or sign in to comment