• Peizhao Zhang's avatar
    Supported learnable qat. · f6ce583e
    Peizhao Zhang authored
    Summary:
    Supported learnable qat.
    * Added a config key `QUANTIZATION.QAT.FAKE_QUANT_METHOD` to specify the qat metod (`default` or `learnable`).
    * Added a config key `QUANTIZATION.QAT.ENABLE_LEARNABLE_OBSERVER_ITER` to specify the start iteration for learnable observers (before that it is using static observers).
    * Custom quantization code needs to call ` d2go.utils.qat_utils.get_qat_qconfig()` to get proper qconfig for learnable qat. An exception will raise if qat method is learnable but no learnable observers are used in the model.
    * Set the weight decay for scale/zero_point to 0 for the optimizer automatically.
    * The way to use larnable qat: enable static observers -> enable fake quant -> enable learnable observers -> freeze bn.
    
    Differential Revision: D31370822
    
    fbshipit-source-id: a5a5044a539d0d7fe1cc6b36e6821fc411ce752a
    f6ce583e
test_runner_default_runner.py 14.8 KB