Skip to content

Commit

Permalink
Fix PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Idan-BenAmi committed Nov 12, 2023
1 parent 1df1636 commit d399870
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions tutorials/notebooks/example_keras_nanodet_plus.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@
"outputs": [],
"source": [
"import model_compression_toolkit as mct\n",
"from typing import Iterator, Tuple\n",
"from typing import Iterator, Tuple, List\n",
"\n",
"REPRESENTATIVE_DATASET_FOLDER = '/content/coco/val2017'\n",
"REPRESENTATIVE_DATASET_ANNOTATION_FILE = '/content/coco/annotations/instances_val2017.json'\n",
Expand All @@ -282,7 +282,7 @@
"def get_representative_dataset(n_iter: int, dataset_loader: Iterator[Tuple]):\n",
" \n",
" def representative_dataset() -> Iterator[List]:\n",
" ds_iter = iter(train_loader)\n",
" ds_iter = iter(dataset_loader)\n",
" for _ in range(n_iter):\n",
" yield [next(ds_iter)[0]]\n",
"\n",
Expand Down
9 changes: 6 additions & 3 deletions tutorials/notebooks/example_keras_yolov8n.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@
"outputs": [],
"source": [
"import model_compression_toolkit as mct\n",
"from typing import Iterator, Tuple\n",
"from typing import Iterator, Tuple, List\n",
"\n",
"REPRESENTATIVE_DATASET_FOLDER = '/content/coco/val2017/'\n",
"REPRESENTATIVE_DATASET_ANNOTATION_FILE = '/content/coco/annotations/instances_val2017.json'\n",
Expand All @@ -280,9 +280,12 @@
"\n",
" return representative_dataset\n",
"\n",
"# Set IMX500-v1 TPC\n",
"tpc = mct.get_target_platform_capabilities(\"tensorflow\", 'imx500', target_platform_version='v1')\n",
"\n",
"# Preform post training quantization \n",
"quant_model, _ = mct.ptq.keras_post_training_quantization_experimental(model,\n",
" get_representative_dataset(n_iters, representative_dataset))\n",
" get_representative_dataset(n_iters, representative_dataset), target_platform_capabilities=tpc)\n",
"\n",
"print('Quantized model is ready')"
]
Expand All @@ -293,7 +296,7 @@
"metadata": {},
"source": [
"### Evaluate quantized model\n",
"Lastly, we can evaluate the performance of the quantized model. There is a slight decrease in performance that can be further mitigated by either expanding the representative dataset or employing MCT's advanced quantization methods, such as EPTQ (Enhanced Post Training Quantization)."
"Lastly, we can evaluate the performance of the quantized model. There is a slight decrease in performance that can be further mitigated by either expanding the representative dataset or employing MCT's advanced quantization methods, such as GPTQ (Gradient-Based/Enhanced Post Training Quantization)."
]
},
{
Expand Down

0 comments on commit d399870

Please sign in to comment.