From 3bf6e9ab06f23302301c9fe28b5ff230e029fe2a Mon Sep 17 00:00:00 2001 From: Ariel Lapid <57916763+lapid92@users.noreply.github.com> Date: Mon, 3 Jun 2024 11:29:15 +0300 Subject: [PATCH] Update MobileVit XS tutorial with z threshold parameter (#1093) * Add z threshold to mobilevit_xs tut --- .../pytorch/pytorch_mobilevit_xs_for_imx500.ipynb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tutorials/notebooks/imx500_notebooks/pytorch/pytorch_mobilevit_xs_for_imx500.ipynb b/tutorials/notebooks/imx500_notebooks/pytorch/pytorch_mobilevit_xs_for_imx500.ipynb index 028932d8a..766601e1e 100644 --- a/tutorials/notebooks/imx500_notebooks/pytorch/pytorch_mobilevit_xs_for_imx500.ipynb +++ b/tutorials/notebooks/imx500_notebooks/pytorch/pytorch_mobilevit_xs_for_imx500.ipynb @@ -214,8 +214,11 @@ "tpc = mct.get_target_platform_capabilities(fw_name=\"pytorch\",\n", " target_platform_name='imx500',\n", " target_platform_version='v1')\n", + "\n", + "# We adjusted the quantization configuration to match the model, activated the shift negative activation correction, and set the z-threshold to 7.0. This is a general best practice for transformer architectures.\n", "ptq_config = mct.core.CoreConfig(quantization_config=mct.core.QuantizationConfig(\n", - " shift_negative_activation_correction=True))\n", + " shift_negative_activation_correction=True,\n", + " z_threshold=7.0))\n", "\n", "# Perform post training quantization\n", "quant_model, _ = mct.ptq.pytorch_post_training_quantization(in_module=model,\n",