Skip to content

Commit ecc49fc

Browse files
kylesayrsrahul-tuli
authored andcommitted
Add usage comment
1 parent 16a9a2f commit ecc49fc

File tree

1 file changed

+5
-4
lines changed
  • src/compressed_tensors/quantization/lifecycle

1 file changed

+5
-4
lines changed

src/compressed_tensors/quantization/lifecycle/apply.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ def apply_quantization_config(
117117
:param run_compressed: Whether the model will be run in compressed mode or
118118
decompressed fully on load
119119
"""
120+
# Workaround for when HF Quantizer passes None, see PR #180
120121
if config is None:
121122
return OrderedDict()
122123

@@ -189,14 +190,14 @@ def apply_quantization_config(
189190
return names_to_scheme
190191

191192

192-
def process_quantization_config(config: QuantizationConfig) -> QuantizationConfig:
193+
def process_quantization_config(config: Optional[QuantizationConfig]) -> Optional[QuantizationConfig]:
193194
"""
194195
Preprocess the raw QuantizationConfig
195196
196-
:param config: the raw QuantizationConfig
197-
:return: the processed QuantizationConfig
197+
:param config: Optional raw QuantizationConfig
198+
:return: the processed QuantizationConfig, if the raw config is not None
198199
"""
199-
if config.kv_cache_scheme is not None:
200+
if config is not None and config.kv_cache_scheme is not None:
200201
config = process_kv_cache_config(config)
201202

202203
return config

0 commit comments

Comments
 (0)