Skip to content
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

Add Idefics3/SmolVLM quant support via traceable class #1095

Merged
merged 5 commits into from
Jan 27, 2025

Conversation

leon-seidel
Copy link
Contributor

SUMMARY:
Adding a traceable Idefics3 class following the new guide to allow W4A16 quants of Idefics3 and SmolVLM (which share the same architecture). Idefics3 seems to require a max_sequence_length of 4096 and I copied the example from the Phi 3 Vision example as the dataset loading approach from the Llava example led to OOM on 64 GB RAM.

TEST PLAN:
Tested on A100 with Idefics3 @512 samples and on a 4060 Ti with SmolVLM @128 samples.

@kylesayrs kylesayrs added the ready When a PR is ready for review label Jan 24, 2025
Copy link
Collaborator

@kylesayrs kylesayrs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution @leon-seidel! This looks great to me, I look forward to getting this landed!

Co-authored-by: Kyle Sayers <kylesayrs@gmail.com>
@kylesayrs
Copy link
Collaborator

Hi @leon-seidel

I've run your example end to end and it looks good! All that's left is to fix the quality tests and this is good to land!

pip install -e ./[dev]
make style
make quality

@kylesayrs
Copy link
Collaborator

kylesayrs commented Jan 24, 2025

Base

hf-multimodal (pretrained=HuggingFaceM4/Idefics3-8B-Llama3,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.3333|±  |0.0875|

W4A16

hf-multimodal (pretrained=Idefics3-8B-Llama3-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.3|±  |0.0851|

Signed-off-by: Leon Seidel <leon.seidel@fau.de>
@leon-seidel
Copy link
Contributor Author

Quality should be fixed now, thanks for your help! Also great tutorial on making the models traceable in the first place. I tried it on my own finetuned Idefics3 model and can't see any deterioration in the outputs!

@kylesayrs kylesayrs requested review from mgoin, kylesayrs, dsikka, rahul-tuli and brian-dellabetta and removed request for mgoin and rahul-tuli January 25, 2025 01:26
kylesayrs
kylesayrs previously approved these changes Jan 25, 2025
@dsikka dsikka merged commit 55cfa1b into vllm-project:main Jan 27, 2025
4 checks passed
rahul-tuli pushed a commit that referenced this pull request Jan 28, 2025
SUMMARY:
Adding a traceable Idefics3 class following the new
[guide](https://github.com/vllm-project/llm-compressor/blob/main/src/llmcompressor/transformers/tracing/GUIDE.md)
to allow W4A16 quants of Idefics3 and SmolVLM (which share the same
architecture). Idefics3 seems to require a max_sequence_length of 4096
and I copied the example from the Phi 3 Vision example as the dataset
loading approach from the Llava example led to OOM on 64 GB RAM.

TEST PLAN:
Tested on A100 with Idefics3 @512 samples and on a 4060 Ti with SmolVLM
@128 samples.

---------

Co-authored-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Rahul Tuli <rahul@neuralmagic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready When a PR is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants