Skip to content

Commit

Permalink
remove QuantizationScheme.default_scheme (#202)
Browse files Browse the repository at this point in the history
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
  • Loading branch information
kylesayrs authored Nov 22, 2024
1 parent 9010372 commit 7103a27
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 24 deletions.
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

0 comments on commit 7103a27

Please sign in to comment.