Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

align torch and keras gptq tutorials #1123

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

align torch and keras gptq tutorials #1123

wants to merge 1 commit into from

Conversation

irenaby
Copy link
Collaborator

@irenaby irenaby commented Jul 3, 2024

Pull Request Description:

Checklist before requesting a review:

  • I set the appropriate labels on the pull request.
  • I have added/updated the release note draft (if necessary).
  • I have updated the documentation to reflect my changes (if necessary).
  • All function and files are well documented.
  • All function and classes have type hints.
  • There is a licenses in all file.
  • The function and variable names are informative.
  • I have checked for code duplications.
  • I have added new unittest (if necessary).

@ofirgo ofirgo removed their request for review July 3, 2024 13:27
"This is achieved through an optimization process applied post-quantization, specifically adjusting the rounding of quantized weights.\n",
"GPTQ is especially effective after mixed precision quantization. \n",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would be more accurate: GPTQ is especially effective in case of low bit width quantization and mixed precision quantization.

"collapsed": false
},
"id": "2c13aff20d208c51"
},
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unify the sequence of code sections into single section..

" os.makedirs(target_dir / lbl)\n",
" \n",
" for img_file, lbl in zip(sorted(os.listdir(imgs_dir)), labels):\n",
" shutil.move(imgs_dir / img_file, target_dir / lbl)\n"
],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've already added such imagenet extractor to: tutorials/notebooks/imx500_notebooks/keras/example_keras_mobilenetv2_for_imx500.ipynb
we need to align.

"\n",
"Please ensure that the dataset path has been set correctly."
"In this tutorial we use the same representative dataset for both statistics collection and GPTQ. A complete pass through the representative dataset generator constitutes an epoch (batch_size x n_iter samples). In this example we use the same dataloader iterator for all epochs, i.e. different images are used in different epochs."
]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a good explanation, but I'd consider to make it shorter or divide it to bullets:

subtitle: representative dataset
Create a generator for the representative dataset ....

A word on GPTQ representative dataset:

  • GPTQ is a gradient-base...
  • In this tutorial we use the same representative dataset..

]
},
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [
"from model_compression_toolkit.gptq.common.gptq_constants import REG_DEFAULT\n",
"# Create a GPTQ quantization configuration and set the number of training iterations. \n",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it will be good to move "import model_compression_toolkit" to this section, to emphasize that we start using the MCT here.

" !wget https://image-net.org/data/ILSVRC/2012/ILSVRC2012_img_val.tar\n",
" !mv ILSVRC2012_img_val.tar imagenet/"
" !wget -P imagenet https://image-net.org/data/ILSVRC/2012/ILSVRC2012_devkit_t12.tar.gz\n",
" !wget -P imagenet https://image-net.org/data/ILSVRC/2012/ILSVRC2012_img_val.tar"
],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nice! same textual comments for the pythorch..

@ofirgo
Copy link
Collaborator

ofirgo commented Jul 15, 2024

@irenaby
Please add PR description including the changes you made

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants