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

[GPTQ Modifier UX] Add default scheme #61

Merged
merged 2 commits into from
May 22, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions src/compressed_tensors/quantization/quant_scheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,32 @@ class QuantizationScheme(BaseModel):
weights: Optional[QuantizationArgs] = None
input_activations: Optional[QuantizationArgs] = None
output_activations: Optional[QuantizationArgs] = None

@classmethod
def default_scheme(
cls,
targets: Optional[List[str]] = None,
):

if targets is None:
# default to quantizing all Linear layers
targets = ["Linear"]

# default to 8 bit integer symmetric quantization
# for weights
weights = QuantizationArgs(num_bits=8, symmetric=True)

# default to 8 bit integer asymmetric quantization
input_activations = QuantizationArgs(num_bits=8, symmetric=False)
Copy link

Choose a reason for hiding this comment

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

vLLM only supports symmetric quantization so lets default this to True as well

bfineran marked this conversation as resolved.
Show resolved Hide resolved

# Do not quantize the output activations
# by default
output_activations = None

return cls(
targets=targets,
weights=weights,
input_activations=input_activations,
output_activations=output_activations,)


Loading