-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Adds 8-bit Integer Quantization Documentation #2193
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
Adds 8-bit Integer Quantization Documentation #2193
Conversation
Summary of ChangesHello @JyotinderSingh, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request adds a detailed guide to Keras's documentation, focusing on 8-bit integer quantization (INT8). The guide aims to educate users on how to leverage INT8 quantization to reduce model memory footprint and potentially speed up inference, while understanding the associated trade-offs. It provides clear explanations and practical code examples to help users implement post-training quantization effectively across various Keras models, including those from KerasHub. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Summary of ChangesHello @JyotinderSingh, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new, detailed guide on 8-bit integer quantization (INT8) for Keras. The documentation provides a thorough explanation of what INT8 quantization is, how it works, its benefits, and potential trade-offs. It also offers practical code examples for quantizing custom Keras models and KerasHub models, demonstrating how to save and reload them, and showcasing the resulting memory footprint reduction. This addition aims to equip users with the knowledge and tools to optimize their Keras models for reduced size and improved inference performance. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request adds comprehensive documentation for 8-bit integer quantization in Keras. The guide is well-structured, covering the concept, a minimal example, saving/loading, and application to a KerasHub model. The code examples are clear and effectively demonstrate the quantization process and its benefits. I've added a few minor suggestions to improve consistency and clarity in the documentation.
hertschuh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
Some small comments.
| ``` | ||
| Full-precision output: Keras is a deep learning library for Python. It is a high-level API for neural networks. It is a Python library for deep learning | ||
|
|
||
| Quantized output: Keras is a deep learning library for Python. It is a high-level API for neural networks. It is a Python library for deep learning |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... is it actually really working :) How far do you have to go to see a difference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch! I looked a little deeper and turns out the graph wasn't being reset, which is why it was giving different outputs on reload. I've opened a fix for this in the following PR: keras-team/keras-hub#2436
I installed that change locally and regenerated the outputs for these docs as well. The outputs are now a little different after quantization, as expected.
bcadbc7 to
99cd6e1
Compare
99cd6e1 to
72c19ac
Compare
No description provided.