Skip to content

Commit d07da41

Browse files
authored
Document MobileNetV3 quantization approach (#5891)
* Document MobileNetV3 quantization approach * Change the URL.
1 parent 79703b2 commit d07da41

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)