[Observers] Allow for case when weight shape and block size are not evenly divisble#2283
[Observers] Allow for case when weight shape and block size are not evenly divisble#2283brian-dellabetta wants to merge 19 commits intomainfrom
Conversation
…isible by block size Signed-off-by: Brian Dellabetta <[email protected]>
|
👋 Hi! Thank you for contributing to llm-compressor. Please add the ready label when the PR is ready for review. Note: This is required to complete the testing suite, please only add the label once the PR is code complete and local testing has been performed. |
Summary of ChangesHello @brian-dellabetta, 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 enhances the robustness of the observer logic within the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. 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
|
|
The quality checks have failed. Please run |
Signed-off-by: Brian Dellabetta <[email protected]>
|
The quality checks have failed. Please run |
There was a problem hiding this comment.
Code Review
This pull request introduces logic to handle cases where weight shapes are not evenly divisible by the block size for block quantization. The core idea of padding the tensor is correct, but the implementation in _flatten_weight has several critical bugs related to padding calculation, tensor creation, and the padding fill logic itself. I've provided a detailed comment with a suggested fix that uses a more standard and robust approach with torch.nn.functional.pad. The other changes to replace assert False with raise ValueError are a good improvement.
Signed-off-by: Brian Dellabetta <[email protected]>
|
/gemini review |
Signed-off-by: Brian Dellabetta <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request introduces a mechanism to handle cases where weight shapes are not evenly divisible by the block size in block quantization. This is achieved by padding the tensors with the mean of the values in the block being padded, which is a sensible approach to avoid distorting quantization parameters. The changes include a new helper function for padding and updates to the weight flattening logic. The accompanying tests are thorough and cover various scenarios. My main feedback is on the complexity of the new padding function, for which I've suggested a minor refactoring to improve readability.
|
Closing in favor of #2290 |
Signed-off-by: Brian Dellabetta <[email protected]>
Signed-off-by: Brian Dellabetta <[email protected]>
Signed-off-by: Brian Dellabetta <[email protected]>
Signed-off-by: Brian Dellabetta <[email protected]>
Signed-off-by: Brian Dellabetta <[email protected]>
Signed-off-by: Brian Dellabetta <[email protected]>
Signed-off-by: Brian Dellabetta <[email protected]>
Signed-off-by: Brian Dellabetta <[email protected]>
Signed-off-by: Brian Dellabetta <[email protected]>
Signed-off-by: Brian Dellabetta <[email protected]>
SUMMARY:
Update observer logic for block strategy when weight shape is not divisible by block size
Prerequisite:
TEST PLAN:
Run script below with
VLLM_BLOCKSCALE_FP8_GEMM_FLASHINFER=1 VLLM_USE_DEEP_GEMM=1for flashinferVLLM_BLOCKSCALE_FP8_GEMM_FLASHINFER=0 VLLM_USE_DEEP_GEMM=1for deepgemmVLLM_BLOCKSCALE_FP8_GEMM_FLASHINFER=0 VLLM_USE_DEEP_GEMM=0for default