Skip to content

Commit 60bae44

Browse files
YosuaMichaelfacebook-github-bot
authored andcommitted
[fbsync] Document MobileNetV3 quantization approach (#5891)
Summary: * Document MobileNetV3 quantization approach * Change the URL. Reviewed By: jdsgomes, NicolasHug Differential Revision: D36095726 fbshipit-source-id: f9a6d1a35c53e890963bd9248d1d9c77e1e48fbb
1 parent b370d59 commit 60bae44

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

torchvision/models/quantization/mobilenetv3.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ def _mobilenet_v3_model(
140140
_replace_relu(model)
141141

142142
if quantize:
143+
# Instead of quantizing the model and then loading the quantized weights we take a different approach.
144+
# We prepare the QAT model, load the QAT weights from training and then convert it.
145+
# This is done to avoid extremely low accuracies observed on the specific model. This is rather a workaround
146+
# for an unresolved bug on the eager quantization API detailed at: https://github.com/pytorch/vision/issues/5890
143147
model.fuse_model(is_qat=True)
144148
model.qconfig = torch.ao.quantization.get_default_qat_qconfig(backend)
145149
torch.ao.quantization.prepare_qat(model, inplace=True)

0 commit comments

Comments
 (0)