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

enable/disable compile for quants methods #36519

Merged
merged 9 commits into from
Mar 17, 2025
Merged

enable/disable compile for quants methods #36519

merged 9 commits into from
Mar 17, 2025

Conversation

SunMarc
Copy link
Member

@SunMarc SunMarc commented Mar 3, 2025

What does this PR do ?

This PR disables compile if the quantization method do not support it. List to be found here. Need to add follow up PRs to allow compile or not for each method + add tests. Only torchao and bnb have the tests for now.

Fixes #36485 (comment)

cc @gante let me know what you think about that. I wanted to still have an easy way to not disable_compile if we wanted.

@github-actions github-actions bot marked this pull request as draft March 3, 2025 18:03
Copy link

github-actions bot commented Mar 3, 2025

Hi 👋, thank you for opening this pull request! The pull request is converted to draft by default. When it is ready for review, please click the Ready for review button (at the bottom of the PR page).

@SunMarc SunMarc marked this pull request as ready for review March 3, 2025 18:03
@SunMarc SunMarc requested a review from gante March 3, 2025 18:03
@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.

@matthewdouglas
Copy link
Member

Thanks @SunMarc! This was on my mind as I ran into this last week :)

SunMarc and others added 2 commits March 4, 2025 13:34
Co-authored-by: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com>
Co-authored-by: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com>
Copy link
Member

@gante gante left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for fixing it 💛

Added two nits that I believe will help with long-term maintenance 🤗

Comment on lines 3220 to 3222
generation_config.disable_compile = not self.hf_quantizer.is_compileable
else:
generation_config.disable_compile = False
Copy link
Member

Choose a reason for hiding this comment

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

nit:
generation_config here doesn't persist across calls, and, in general, I'm moving away from mutating generation_config so we can better distinguish user flags from our internal handling (especially in the decoding methods, like _sample).

Can we instead set is_compileable accordingly?

Copy link
Member Author

Choose a reason for hiding this comment

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

done !

SunMarc and others added 2 commits March 13, 2025 17:26
Co-authored-by: Joao Gante <joaofranciscocardosogante@gmail.com>
@SunMarc SunMarc requested a review from gante March 13, 2025 16:56
@SunMarc
Copy link
Member Author

SunMarc commented Mar 13, 2025

Let me know if this is better @gante !

Copy link
Member

@gante gante left a comment

Choose a reason for hiding this comment

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

Looks great, thank you for iterating 💪

@SunMarc SunMarc merged commit 9e94801 into main Mar 17, 2025
24 checks passed
@SunMarc SunMarc deleted the quantizer-compileable branch March 17, 2025 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants