-
Notifications
You must be signed in to change notification settings - Fork 72
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
[WIP] Fix hessian memory requirements #1084
Draft
kylesayrs
wants to merge
9
commits into
main
Choose a base branch
from
kylesayrs/qwen2_large
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains 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
Signed-off-by: Kyle Sayers <[email protected]>
Signed-off-by: Kyle Sayers <[email protected]>
Signed-off-by: Kyle Sayers <[email protected]>
Signed-off-by: Kyle Sayers <[email protected]>
Signed-off-by: Kyle Sayers <[email protected]>
Merged
👋 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. |
Signed-off-by: Kyle Sayers <[email protected]>
Signed-off-by: Kyle Sayers <[email protected]>
mgoin
pushed a commit
that referenced
this pull request
Jan 20, 2025
## Purpose ## * Support compressing Qwen2VLForConditionalGeneration with vision calibration data ## Follow-ups ## * `Qwen/Qwen2-VL-72B-Instruct` has memory issues that are unrelated to the VLM architecture and which result from incorrect assumptions in `calculate_offload_device_map`. See #1084 * When this lands, we'll replace the `2B` example with the `72B` example, since the accuracy loss from quantizing a 2B is pretty severe ## Changes ## * Add tracable model definition`src/llmcompressor/transformers/tracing/qwen2_vl.py` * This mostly involves wrapping functions related to rope with image embeddings * The `_prepare_4d_causal_attention_mask_with_cache_position` function has conditional logic `if attention_mask is not None`. This might be fixable with metadata in the future * Add example script `examples/multimodal_vision/qwen2_vl_example.py` * Qwen2_vl requires some custom data preprocessing and tokenization, which is implemented in the example script ## Testing ## * Ran `examples/multimodal_vision/qwen2_vl_example.py` to completion with both 2B ``` ========== SAMPLE GENERATION ============== system You are a helpful assistant. user Please describe the animal in this image assistant The animal in the image is a white kitten. It has a fluffy coat and is resting on a white keyboard. The kitten appears to be comfortable and relaxed, possibly enjoying the warmth of the keyboard. ========================================== ``` </details> ## Evaluation ## Base ``` hf-multimodal (pretrained=Qwen/Qwen2-VL-2B-Instruct,dtype=bfloat16,add_bos_token=True,convert_img_format=True), gen_kwargs: (None), limit: None, num_fewshot: None, batch_size: 1 | Tasks |Version|Filter|n-shot|Metric| |Value| |Stderr| |----------------|------:|------|-----:|------|---|----:|---|-----:| |Computer Science| 0|none | 0|acc |↑ | 0.2|± |0.0743| ``` Quantized ``` hf-multimodal (pretrained=/home/kyle/llm-compressor/Qwen2-VL-2B-Instruct-W4A16-G128,dtype=bfloat16,add_bos_token=True,convert_img_format=True), gen_kwargs: (None), limit: None, num_fewshot: None, batch_size: 1 | Tasks |Version|Filter|n-shot|Metric| |Value| |Stderr| |----------------|------:|------|-----:|------|---|----:|---|-----:| |Computer Science| 0|none | 0|acc |↑ | 0.1|± |0.0557| ``` > we'll replace the 2B example with the 72B example, since the accuracy loss from quantizing a 2B is pretty severe --------- Signed-off-by: Kyle Sayers <[email protected]>
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.
No description provided.