"git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "87cf88ed3d351cc4e2b7cdd462ddf7a4ebf2109e"
Unverified Commit d07da41d authored by Vasilis Vryniotis's avatar Vasilis Vryniotis Committed by GitHub
Browse files

Document MobileNetV3 quantization approach (#5891)

* Document MobileNetV3 quantization approach

* Change the URL.
parent 79703b26
...@@ -140,6 +140,10 @@ def _mobilenet_v3_model( ...@@ -140,6 +140,10 @@ def _mobilenet_v3_model(
_replace_relu(model) _replace_relu(model)
if quantize: if quantize:
# Instead of quantizing the model and then loading the quantized weights we take a different approach.
# We prepare the QAT model, load the QAT weights from training and then convert it.
# This is done to avoid extremely low accuracies observed on the specific model. This is rather a workaround
# for an unresolved bug on the eager quantization API detailed at: https://github.com/pytorch/vision/issues/5890
model.fuse_model(is_qat=True) model.fuse_model(is_qat=True)
model.qconfig = torch.ao.quantization.get_default_qat_qconfig(backend) model.qconfig = torch.ao.quantization.get_default_qat_qconfig(backend)
torch.ao.quantization.prepare_qat(model, inplace=True) torch.ao.quantization.prepare_qat(model, inplace=True)
......
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