Skip to content

Commit

Permalink
depreciate get_observer
Browse files Browse the repository at this point in the history
Signed-off-by: Kyle Sayers <[email protected]>
  • Loading branch information
kylesayrs committed Nov 27, 2024
1 parent 525ef3a commit 42ddee9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/compressed_tensors/quantization/quant_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/compressed_tensors/quantization/quant_scheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def validate_model_after(model: "QuantizationArgs") -> Dict[str, Any]:

return model


"""
Pre-Set Quantization Scheme Args
"""
Expand Down

0 comments on commit 42ddee9

Please sign in to comment.