From 42ddee90b18af17f498a3e6ad818f2d3b1a685f4 Mon Sep 17 00:00:00 2001 From: Kyle Sayers Date: Wed, 27 Nov 2024 03:07:12 +0000 Subject: [PATCH] depreciate get_observer Signed-off-by: Kyle Sayers --- src/compressed_tensors/quantization/quant_args.py | 13 +++++++------ src/compressed_tensors/quantization/quant_scheme.py | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/compressed_tensors/quantization/quant_args.py b/src/compressed_tensors/quantization/quant_args.py index 4619d581..43e6d624 100644 --- a/src/compressed_tensors/quantization/quant_args.py +++ b/src/compressed_tensors/quantization/quant_args.py @@ -110,12 +110,6 @@ class QuantizationArgs(BaseModel, use_enum_values=True): ), ) - def get_observer(self): - """ - :return: torch quantization FakeQuantize built based on these QuantizationArgs - """ - return self.observer - @field_validator("type", mode="before") def validate_type(cls, value) -> QuantizationType: if isinstance(value, str): @@ -237,6 +231,13 @@ def pytorch_dtype(self) -> torch.dtype: else: raise ValueError(f"Invalid quantization type {self.type}") + def get_observer(self) -> str: + warnings.warn( + "`get_observer` is depreciated, please use `observer` attribute instead", + DeprecationWarning, + ) + return self.observer + def round_to_quantized_type( tensor: torch.Tensor, args: QuantizationArgs diff --git a/src/compressed_tensors/quantization/quant_scheme.py b/src/compressed_tensors/quantization/quant_scheme.py index 3a8152da..36b88604 100644 --- a/src/compressed_tensors/quantization/quant_scheme.py +++ b/src/compressed_tensors/quantization/quant_scheme.py @@ -62,6 +62,7 @@ def validate_model_after(model: "QuantizationArgs") -> Dict[str, Any]: return model + """ Pre-Set Quantization Scheme Args """