-
Notifications
You must be signed in to change notification settings - Fork 6.2k
support hf_quantizer
in cache warmup.
#12043
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
base: main
Are you sure you want to change the base?
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, changes look good!
- Use a division factor of 4 for int8 weights | ||
""" | ||
# Original mapping for non-AOBaseConfig types | ||
map_to_target_dtype = {"int4_*": 8, "int8_*": 4, "float8*": 4} |
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.
Need to handle more of these exhaustively:
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.
Took a best guess of "8" for the unsigned int types. I think we can tackle more of these nuanced / lesser-used types as they become a bit more used. I think the int8 and fp8 types are far more common for now 👀
So, I have added a comment as well.
What does this PR do?
Takes the warmup function close to https://github.com/huggingface/transformers/blob/d3b8627b56caa7ca8fac113c9f28d0256db0194d/src/transformers/modeling_utils.py#L5969
I have gone ahead and also run a snippet from #11904 (comment) and noticed similar timings. So, running the snippet
main
and this PR branch should yield similar results (not identical because we cannot control it but the difference should be negligible).