Skip to content

Commit a654f6c

Browse files
authored
Update QuantizationScheme defaults (#157)
* remove weight and input details * add default test * PR comments
1 parent 9e5e627 commit a654f6c

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

src/compressed_tensors/quantization/quant_scheme.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,9 @@ def default_scheme(
5757
# default to quantizing all Linear layers
5858
targets = ["Linear"]
5959

60-
# default to 8 bit integer symmetric quantization
61-
# for weights
62-
weights = QuantizationArgs(num_bits=8, symmetric=True)
63-
64-
# default to 8 bit integer asymmetric quantization
65-
input_activations = QuantizationArgs(num_bits=8, symmetric=True)
66-
67-
# Do not quantize the output activations
68-
# by default
60+
# by default, activations and weights are left unquantized
61+
weights = None
62+
input_activations = None
6963
output_activations = None
7064

7165
return cls(
@@ -110,6 +104,7 @@ def is_preset_scheme(name: str) -> bool:
110104
"""
111105
return name.upper() in PRESET_SCHEMES
112106

107+
113108
UNQUANTIZED = dict()
114109

115110
# 8 bit integer weights and 8 bit activations quantization

tests/test_quantization/test_quant_scheme.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313
# limitations under the License.
1414

1515
import pytest
16-
from compressed_tensors.quantization import QuantizationArgs, QuantizationScheme
16+
from compressed_tensors.quantization import (
17+
QuantizationArgs,
18+
QuantizationConfig,
19+
QuantizationScheme,
20+
)
1721
from pydantic import ValidationError
1822

1923

@@ -49,3 +53,11 @@ def test_full_scheme():
4953
def test_needs_targets():
5054
with pytest.raises(ValidationError):
5155
_ = QuantizationScheme()
56+
57+
58+
def test_defaults():
59+
targets = ["Linear"]
60+
output = QuantizationScheme.default_scheme(targets=targets)
61+
assert output.weights is None
62+
assert output.input_activations is None
63+
assert output.output_activations is None

0 commit comments

Comments
 (0)