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

Enables CPU AWQ model with IPEX version. #33460

Merged
merged 13 commits into from
Oct 4, 2024
Merged

Conversation

jiqing-feng
Copy link
Contributor

@jiqing-feng jiqing-feng commented Sep 13, 2024

This PR enables CPU AWQ model with IPEX version.

@jiqing-feng jiqing-feng changed the title Awq Enables CPU AWQ model with IPEX kernel. Sep 13, 2024
@jiqing-feng jiqing-feng changed the title Enables CPU AWQ model with IPEX kernel. Enables CPU AWQ model with IPEX version. Sep 13, 2024
@jiqing-feng jiqing-feng marked this pull request as ready for review September 13, 2024 08:45
@jiqing-feng
Copy link
Contributor Author

Hi @SunMarc . Do you mind reviewing this PR? It enables AutoAWQ CPU path. Thx!

@jiqing-feng
Copy link
Contributor Author

Hi @SunMarc @ArthurZucker . This PR is ready to be reviewed. Thx!

Copy link
Member

@SunMarc SunMarc left a comment

Choose a reason for hiding this comment

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

Thanks for this addition @jiqing-feng ! Left a few comments

jiqing-feng and others added 3 commits October 1, 2024 14:53
Co-authored-by: Marc Sun <57196510+SunMarc@users.noreply.github.com>
Co-authored-by: Marc Sun <57196510+SunMarc@users.noreply.github.com>
@jiqing-feng
Copy link
Contributor Author

Hi @SunMarc . I have fixed all your comments, please review it. Thx!

Copy link
Member

@SunMarc SunMarc left a comment

Choose a reason for hiding this comment

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

Nice ! Thanks for iterating @jiqing-feng ! Just a small nit

_fuse_awq_mlp(model, name, modules_to_fuse["mlp"], module, QuantFusedMLP)
# Replace MLP layers if awq version is not ipex.
if quantization_config.version != "ipex":
logger.info("The IPEX version AWQ does not support fuse mlp for now.")
Copy link
Member

Choose a reason for hiding this comment

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

To put in the else condition

Comment on lines 66 to 67
if not torch.cuda.is_available():
raise RuntimeError("GPU is required to run AWQ quantized model.")
Copy link
Member

Choose a reason for hiding this comment

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

You can also add in the error that the user can try with ipex if they have an intel CPU.

@HuggingFaceDocBuilderDev

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.

@SunMarc SunMarc requested a review from ArthurZucker October 1, 2024 13:05
@jiqing-feng
Copy link
Contributor Author

Hi @SunMarc . I have fixed the log, now it's ready to merge. Thanks!

Copy link
Collaborator

@ArthurZucker ArthurZucker left a comment

Choose a reason for hiding this comment

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

Clean 🧼 thanks 🤗

@ArthurZucker ArthurZucker merged commit b916efc into huggingface:main Oct 4, 2024
24 checks passed
@jiqing-feng jiqing-feng mentioned this pull request Nov 13, 2024
BernardZach pushed a commit to BernardZach/transformers that referenced this pull request Dec 5, 2024
* enable cpu awq ipex linear

* add doc for cpu awq with ipex kernel

* add tests for cpu awq

* fix code style

* fix doc and tests

* Update docs/source/en/quantization/awq.md

Co-authored-by: Marc Sun <57196510+SunMarc@users.noreply.github.com>

* Update tests/quantization/autoawq/test_awq.py

Co-authored-by: Marc Sun <57196510+SunMarc@users.noreply.github.com>

* fix comments

* fix log

* fix log

* fix style

---------

Co-authored-by: Marc Sun <57196510+SunMarc@users.noreply.github.com>
@jiqing-feng jiqing-feng deleted the awq branch December 19, 2024 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants