]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - jacinto-ai/pytorch-jacinto-ai-devkit.git/commitdiff
quantization docs updated
authorManu Mathew <a0393608@ti.com>
Thu, 30 Apr 2020 14:54:22 +0000 (20:24 +0530)
committerManu Mathew <a0393608@ti.com>
Thu, 30 Apr 2020 14:54:35 +0000 (20:24 +0530)
docs/Quantization.md

index 6678f04d7e3ff0414b07fbeb01d1538e2b929fc9..4b10cfc69d4cafa5ecf60b138a89a625c0b688d8 100644 (file)
@@ -30,6 +30,7 @@ To get best accuracy at the quantization stage, it is important that the model i
 - If your calibration/training crashes with insufficient GPU memory, reduce the batch size and try again.
 - **The same module should not be re-used multiple times within the module** in order that the activation range estimation is correct. Unfortunately, in the torchvision ResNet models, the ReLU module in the BasicBlock and BottleneckBlock are re-used multiple times. We have corrected this by defining separate ReLU modules. This change is minor and **does not** affect the loading of existing pretrained weights. See the [our modified ResNet model definition here](./modules/pytorch_jacinto_ai/vision/models/resnet.py).<br>
 - **Use Modules instead of functions** (we make use of modules to decide whether to do activation range clipping or not). For example use torch.nn.reLU instead of torch.nn.functional.relu(), torch.nn.AdaptiveAvgPool2d() instead of torch.nn.functional.adaptive_avg_pool2d(), torch.nn.Flatten() instead of torch.nn.functional.flatten() etc. If you are using functions in your model and is giving poor quantized accuracy, then consider replacing those functions by the corresponding modules.<br>
 - If your calibration/training crashes with insufficient GPU memory, reduce the batch size and try again.
 - **The same module should not be re-used multiple times within the module** in order that the activation range estimation is correct. Unfortunately, in the torchvision ResNet models, the ReLU module in the BasicBlock and BottleneckBlock are re-used multiple times. We have corrected this by defining separate ReLU modules. This change is minor and **does not** affect the loading of existing pretrained weights. See the [our modified ResNet model definition here](./modules/pytorch_jacinto_ai/vision/models/resnet.py).<br>
 - **Use Modules instead of functions** (we make use of modules to decide whether to do activation range clipping or not). For example use torch.nn.reLU instead of torch.nn.functional.relu(), torch.nn.AdaptiveAvgPool2d() instead of torch.nn.functional.adaptive_avg_pool2d(), torch.nn.Flatten() instead of torch.nn.functional.flatten() etc. If you are using functions in your model and is giving poor quantized accuracy, then consider replacing those functions by the corresponding modules.<br>
+- If you are using TIDL to infer a model trained using QAT (or calibratied using PTQ) tools provided in this repository, please set **quantizationStyle = 3** in TIDL import config to use power of 2 quantization.
 
 ## Post Training Calibration For Quantization (PTQ a.k.a. Calibration)
 **Note: this is not our recommended method in PyTorch.**<br>
 
 ## Post Training Calibration For Quantization (PTQ a.k.a. Calibration)
 **Note: this is not our recommended method in PyTorch.**<br>