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

Remove QuantizationScheme.default_scheme #202

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
24 changes: 1 addition & 23 deletions src/compressed_tensors/quantization/quant_scheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class QuantizationScheme(BaseModel):
of modules should be quantized

:param targets: list of modules to apply the QuantizationArgs to, can be layer
names, layer types or a regular expression
names, layer types or a regular expression, typically ["Linear"]
:param weights: quantization config for layer weights
:param input_activations: quantization config for layer inputs
:param output_activations: quantization config for layer outputs
Expand All @@ -47,28 +47,6 @@ class QuantizationScheme(BaseModel):
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"]

# by default, activations and weights are left unquantized
weights = None
input_activations = None
output_activations = None

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


"""
Pre-Set Quantization Scheme Args
Expand Down
2 changes: 1 addition & 1 deletion tests/test_quantization/test_quant_scheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def test_needs_targets():

def test_defaults():
targets = ["Linear"]
output = QuantizationScheme.default_scheme(targets=targets)
output = QuantizationScheme(targets=targets)
assert output.weights is None
assert output.input_activations is None
assert output.output_activations is None
Loading