Skip to content

Commit 08ba603

Browse files
Revised the tutorial in response to reviews
1 parent 1f36527 commit 08ba603

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ Modify your model's quantization configuration for specific layers or apply a cu
105105

106106
**🔑 XQuant (Explainable Quantization)** [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/SonySemiconductorSolutions/mct-model-optimization/blob/main/tutorials/notebooks/mct_features_notebooks/pytorch/example_pytorch_xquant.ipynb). Get valuable insights regarding the quality and success of the quantization process of your model. The report includes histograms and similarity metrics between the original float model and the quantized model in key points of the model. The report can be visualized using TensorBoard.
107107

108-
**🔑 XQuant Extension Tool.** Calculates the error for each layer by comparing the float model and quantized model, using both models along with the quantization log. The results are presented in reports. It identifies the causes of the detected errors and recommends appropriate improvement measures for each cause. [Read more](https://sonysemiconductorsolutions.github.io/mct-model-optimization/guidelines/XQuant_Extension_Tool.html) [Troubleshoot Manual](https://sonysemiconductorsolutions.github.io/mct-model-optimization/docs_troubleshoot/index.html)
108+
**🔑 XQuant Extension Tool.** [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/SonySemiconductorSolutions/mct-model-optimization/blob/main/tutorials/notebooks/mct_features_notebooks/pytorch/example_pytorch_XQuant_Extension_Tool.ipynb). Calculates the error for each layer by comparing the float model and quantized model, using both models along with the quantization log. The results are presented in reports. It identifies the causes of the detected errors and recommends appropriate improvement measures for each cause. [Read more](https://sonysemiconductorsolutions.github.io/mct-model-optimization/guidelines/XQuant_Extension_Tool.html) [Troubleshoot Manual](https://sonysemiconductorsolutions.github.io/mct-model-optimization/docs_troubleshoot/index.html)
109109

110110
__________________________________________________________________________________________________________
111111
### Enhanced Post-Training Quantization (EPTQ)

tutorials/notebooks/mct_features_notebooks/pytorch/example_pytorch_XQuant_Extension_Tool.ipynb

Lines changed: 11 additions & 11 deletions
Large diffs are not rendered by default.

tutorials/notebooks/mct_features_notebooks/pytorch/example_pytorch_XQuant_Extension_Tool_General.ipynb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@
168168
"metadata": {},
169169
"source": [
170170
"## Evaluation Function\n",
171-
"Evaluate the model's performance using the test data loader and calculate and return the overall classification accuracy."
171+
"Evaluate the model's performance using the validation data loader and calculate and return the overall classification accuracy."
172172
]
173173
},
174174
{
@@ -177,17 +177,17 @@
177177
"metadata": {},
178178
"outputs": [],
179179
"source": [
180-
"def evaluate(model, testloader):\n",
180+
"def evaluate(model, val_dataloader):\n",
181181
" \"\"\"\n",
182-
" Evaluate a model using a test loader.\n",
182+
" Evaluate a model using a validation loader.\n",
183183
" \"\"\"\n",
184184
" device = torch.device(\"cuda:0\" if torch.cuda.is_available() else \"cpu\")\n",
185185
" model.to(device)\n",
186186
" model.eval() # Set the model to evaluation mode\n",
187187
" correct = 0\n",
188188
" total = 0\n",
189189
" with torch.no_grad():\n",
190-
" for data in tqdm(testloader):\n",
190+
" for data in tqdm(val_dataloader):\n",
191191
" images, labels = data\n",
192192
" images, labels = images.to(device), labels.to(device)\n",
193193
" outputs = model(images)\n",
@@ -216,7 +216,7 @@
216216
},
217217
"outputs": [],
218218
"source": [
219-
"# Get a FrameworkQuantizationCapabilities object that models the hardware platform for the quantized model inference. \n",
219+
"# Get a TargetPlatformCapabilities object that models the hardware platform for the quantized model inference. \n",
220220
"target_platform_cap = mct.get_target_platform_capabilities(tpc_version=1.0)\n",
221221
"configuration = mct.core.CoreConfig()\n",
222222
"dataloader = make_dataloader_and_reset_random_seed()\n",
@@ -619,7 +619,7 @@
619619
"metadata": {},
620620
"source": [
621621
"## Conclusion\n",
622-
"These analyses showed that accuracy improved by 0.31% when the number of images was 80, and by 0.54% when the number of GPTQ epochs was 80, resulting in a reduced quantization accuracy loss.Following these troubleshooting steps can help improve the accuracy of your quantized model.By following these troubleshooting steps, you can improve the accuracy of your quantized model."
622+
"These analyses showed that accuracy improved by 0.31% when the number of images was 80, and by 0.54% when the number of GPTQ epochs was 80, resulting in a reduced quantization accuracy loss.By following these troubleshooting steps, you can improve the accuracy of your quantized model."
623623
]
624624
},
625625
{

0 commit comments

Comments
 (0)