"vscode:/vscode.git/clone" did not exist on "7c823c2ed72aed5dc0db24f368a3663302e71177"
Commit e3642005 authored by Jiaxu Zhu's avatar Jiaxu Zhu Committed by Facebook GitHub Bot
Browse files

Quantize FBS model with 16bit FX Quantization

Summary:
Pull Request resolved: https://github.com/facebookresearch/d2go/pull/531

As title, enable mixed precision FX quantization for FBS model.

This diff includes
1. Add `custom_prepare_fx` to the FBS d2go model to enable the FX quantization.
2. Add two new d2go config params `QUANTIZATION.ACT_BITS/QUANTIZATION.WEIGHTS`
3. Add `backend_config/qconfig_mapping` to d2go convert function calls.
4. Add an example FBS fx QAT config.

Reviewed By: ayushidalmia

Differential Revision: D45252545

fbshipit-source-id: 813b192fcdd66c17629490b8908ce8cd8534506a
parent 859f0bb9
...@@ -21,5 +21,5 @@ def get_prepare_fx_fn(cfg, is_qat): ...@@ -21,5 +21,5 @@ def get_prepare_fx_fn(cfg, is_qat):
@fb_overwritable() @fb_overwritable()
def get_convert_fx_fn(cfg, example_inputs): def get_convert_fx_fn(cfg, example_inputs, qconfig_mapping=None, backend_config=None):
return convert_fx return convert_fx
...@@ -141,6 +141,8 @@ def add_quantization_default_configs(_C): ...@@ -141,6 +141,8 @@ def add_quantization_default_configs(_C):
_C.QUANTIZATION.MODULES = [] _C.QUANTIZATION.MODULES = []
# Lightning quantization callback name # Lightning quantization callback name
_C.QUANTIZATION.NAME = "" _C.QUANTIZATION.NAME = ""
_C.QUANTIZATION.ACT_BITS = 8
_C.QUANTIZATION.WEIGHT_BITS = 8
# quantization-aware training # quantization-aware training
_C.QUANTIZATION.QAT = CfgNode() _C.QUANTIZATION.QAT = CfgNode()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment