-
Notifications
You must be signed in to change notification settings - Fork 28.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Exllama kernels support for AWQ models #28634
Exllama kernels support for AWQ models #28634
Conversation
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making exllama kernel compatible with AWQ models ! This will make AWQ so much faster ! I've left a few minor comments.
Co-authored-by: Marc Sun <57196510+SunMarc@users.noreply.github.com>
I guess all points are addressed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for adding the ex-llama v2 support ! 🔥
Let's add autoawq==0.1.9 in the Dockerfile:
RUN python3 -m pip install --no-cache-dir https://github.com/casper-hansen/AutoAWQ/releases/download/v0.1.8/autoawq-0.1.8+cu118-cp38-cp38-linux_x86_64.whl |
Do you know also if this feature is supported on NVIDIA T4 GPUs? If that's the case can you add a simple generation test in: https://github.com/huggingface/transformers/blob/main/tests/quantization/autoawq/test_awq.py
Thanks !
@younesbelkada The next release will be 0.2.0 🤗. For T4 support, I have not tested it. If AutoGPTQ supports T4 with ExLlama v1 and v2 kernels, AutoAWQ should too as the kernels are the same. EDIT: To answer the timeline question. There is no set-in-stone plan for the next release. PRs to be merged before release include AMD support, Marlin support, Qwen2 support, and hopefully PEFT support. I expect this could be done in <1-2 weeks. |
Awesome! Per my understanding ex-llama + AutoGPTQ should be supported on T4 so it should be all good ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@IlyasMoutawwakil - #26610 being merged would you be happy to transfer the logic inside transformers/src/quantizers/quantizer_awq.py
's post-processing method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks very much @IlyasMoutawwakil ! I left one suggestion - what do you think?
src/transformers/integrations/awq.py
Outdated
|
||
# default values for exllamav2 from | ||
# https://github.com/AutoGPTQ/AutoGPTQ/blob/6ba14f17ef73c161c2c4707cbf0b41e569a9c6dd/auto_gptq/nn_modules/qlinear/qlinear_exllamav2.py#L171 | ||
model = exllamav2_post_init(model, max_input_len=2048, max_batch_size=8) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
couldn't we make max_input_len
configurable through AwqConfig
- wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Marc suggested we leave it as is for now #28634 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh okay ! I think it would makes sense to directly expose a exllama_config
I think - wdyt @SunMarc ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it would make more sense to expose it in a exllama_config
!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess in another PR right ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm I think it should be better to add it now and not leave the main branch with hardcoded config values, it shouldn't be super complex as you can just copy over the existing logic in GptqConfig right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks already really nice thanks to the integration refactor!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, clean ! Let's merge this PR right after the next release of autoawq
@casper-hansen do you have any ETA for the next release?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that @casper-hansen already made the release of awq with exllama kernel. Can you check that everything works fine with the latest release @IlyasMoutawwakil ? Then, we are good to merge !
@SunMarc on it! |
works on rocm5.6 with torch 2.2 import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, AwqConfig
quantization_config = AwqConfig(version="exllama")
model = AutoModelForCausalLM.from_pretrained(
"TheBloke/Mistral-7B-Instruct-v0.1-AWQ",
quantization_config=quantization_config,
device_map="auto" or torch.device("cuda"),
)
input_ids = torch.randint(0, 100, (1, 128), dtype=torch.long, device="cuda")
output = model(input_ids)
print(output.logits)
tokenizer = AutoTokenizer.from_pretrained("TheBloke/Mistral-7B-Instruct-v0.1-AWQ")
input_ids = tokenizer.encode("How to make a cake", return_tensors="pt").to(model.device)
output = model.generate(input_ids, do_sample=True, max_length=50, pad_token_id=50256)
print(tokenizer.decode(output[0], skip_special_tokens=True)) The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks LGTM with one nit !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for adding exllama support 🔥
What does this PR do?
Following casper-hansen/AutoAWQ#313
ExllamaV2 offers up to 2x speedup compared to GEMM, while also compatible with AMD ROCm.
Before submitting
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
@SunMarc and @younesbelkada