Feat (brevitas_examples/llm): support for fully custom quantizers#1454
Closed
Giuseppe5 wants to merge 6 commits intoXilinx:devfrom
Closed
Feat (brevitas_examples/llm): support for fully custom quantizers#1454Giuseppe5 wants to merge 6 commits intoXilinx:devfrom
Giuseppe5 wants to merge 6 commits intoXilinx:devfrom
Conversation
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.
Reason for this PR
Currently, every time we need to support a new quantization type, we need to modify our entry-point in several ways (e.g., new args, new option in the dict), and this process does not scale up with more advanced quantization schemes.
Changes Made in this PR
This PR allows the user to specify a file with custom quantizers to use for our LLM entrypoint.
The user can optionally specify up to seven quantizers:
weight_quantizerinput_linear_quantizer: quantizer used specifically in linear layersinput_quant: for all other layers that are not linear (e.g., if there are conv in the network)q_scaled_quant,k_transposed_quant,v_quant: quantizers for QKV in scaled dot productattn_output_weights_quant: quantization for the output of sigmoid of scaled dot productThese quantizers should be put in a dict, using they specified above.
If any of the keys is not specified, then the quantizer is set to None (equivalent to no quantization)
Testing Summary
TBD