-
Notifications
You must be signed in to change notification settings - Fork 296
[AWQ] Allow for activation quantization #1682
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
Changes from all commits
7be5bf6
3662be1
a777241
48dbcb5
3f01afa
584a432
ef26dc4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| import inspect | ||
| import warnings | ||
| from typing import Dict, List, Optional, Tuple, Union | ||
|
|
||
| import torch | ||
|
|
@@ -181,25 +182,20 @@ def validate_model_after(model: "AWQModifier") -> "AWQModifier": | |
|
|
||
| model._group_size = next(iter(group_size_set)) | ||
|
|
||
| in_num_bits_set = set( | ||
| group.input_activations.num_bits | ||
| num_bits_set = { | ||
| act.num_bits | ||
| for group in config.config_groups.values() | ||
| if group.input_activations is not None | ||
| ) | ||
| assert len(in_num_bits_set) == 0 or in_num_bits_set == {16}, ( | ||
| "AWQ activations must be 16-bit precision, " | ||
| f"input activations {in_num_bits_set} not allowed" | ||
| ) | ||
|
|
||
| out_num_bits_set = set( | ||
| group.output_activations.num_bits | ||
| for group in config.config_groups.values() | ||
| if group.output_activations is not None | ||
| ) | ||
| assert len(out_num_bits_set) == 0 or out_num_bits_set == {16}, ( | ||
| "AWQ activations must be 16-bit precision, " | ||
| f"output activations {out_num_bits_set} not allowed" | ||
| ) | ||
| for act in (group.input_activations, group.output_activations) | ||
| if act is not None | ||
| } | ||
| if not (len(num_bits_set) == 0 or num_bits_set == {16}): | ||
| warnings.warn( | ||
| "A strategy including activation quantization was detected. " | ||
| "AWQ was originally intended for weight-only quantization. " | ||
| "Lower-precision activations are an experimental feature, and " | ||
| "overall performance may be poor. If it is, consider using " | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @HDCharles I think you reported that AWQ activation quantization is supposed to perform decently?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've definitely seen people do it but I think I was echoing the same sentiment as here, the paper is entirely weight only quantization oriented which is odd for an equalization technique. |
||
| "`W4A16` or `W4A16_ASYM` quantization schemes instead." | ||
| ) | ||
|
|
||
| return model | ||
|
|
||
|
|
||
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.