Open
Conversation
- Added dequantization step in Normalize class for quantized inputs. - Updated QuantizedImageBindModel to accept a quantization configuration. - Refactored quantization stubs to utilize the provided q_config. - Introduced quantization in MultiheadAttention and DropPath classes. - Modified quantized.py to include q_config setup and model quantization process.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces quantization support for the ImageBind model, enabling efficient inference with reduced precision. The changes include adding new quantization-related classes, modifying existing components to support quantization, and providing a script for model quantization and evaluation.
Quantization Support Enhancements:
New Quantization Classes:
QuantizableMultiheadAttentionandQuantizedMultiheadAttentionclasses to support quantized attention mechanisms in the transformer module (imagebind/models/transformer.py). [1] [2]QuantizedDropPathto handle quantization-aware stochastic depth. This class includes quantization and dequantization stubs for compatibility with quantized models (imagebind/models/transformer.py).Integration of Quantization in Model Components:
DropPathwithQuantizedDropPathand addednn.quantized.FloatFunctionalfor skip connections in the transformer blocks (imagebind/models/transformer.py). [1] [2]MultiheadAttentionwithQuantizableMultiheadAttentionin the model's trunk instantiation (imagebind/models/imagebind_model.py).Codebase Refactoring for Readability:
imagebind/models/imagebind_model.py).extra_reprfor theLearnableLogitScalingclass (imagebind/models/helpers.py).Quantization Workflow Script:
quantized.py) to demonstrate the quantization process, including:Minor Improvements:
Normalizeclass (imagebind/models/helpers.py).imagebind/models/imagebind_model.py).