diff --git a/src/diffusers/quantizers/quantization_config.py b/src/diffusers/quantizers/quantization_config.py index 138ec7b7e989..9a467e6b21ee 100644 --- a/src/diffusers/quantizers/quantization_config.py +++ b/src/diffusers/quantizers/quantization_config.py @@ -36,7 +36,7 @@ from packaging import version -from ..utils import is_torch_available, is_torchao_available, is_torchao_version, logging +from ..utils import deprecate, is_torch_available, is_torchao_available, is_torchao_version, logging if is_torch_available(): @@ -844,6 +844,8 @@ def __init__( modules_to_not_convert: list[str] | None = None, **kwargs, ): + deprecation_message = "`QuantoConfig` is deprecated and will be removed in version 1.0.0." + deprecate("QuantoConfig", "1.0.0", deprecation_message) self.quant_method = QuantizationMethod.QUANTO self.weights_dtype = weights_dtype self.modules_to_not_convert = modules_to_not_convert diff --git a/src/diffusers/quantizers/quanto/quanto_quantizer.py b/src/diffusers/quantizers/quanto/quanto_quantizer.py index a036dabfe6f4..9a04291c883a 100644 --- a/src/diffusers/quantizers/quanto/quanto_quantizer.py +++ b/src/diffusers/quantizers/quanto/quanto_quantizer.py @@ -3,6 +3,7 @@ from diffusers.utils.import_utils import is_optimum_quanto_version from ...utils import ( + deprecate, get_module_from_name, is_accelerate_available, is_accelerate_version, @@ -42,6 +43,9 @@ def __init__(self, quantization_config, **kwargs): super().__init__(quantization_config, **kwargs) def validate_environment(self, *args, **kwargs): + deprecation_message = "The Quanto quantizer is deprecated and will be removed in version 1.0.0." + deprecate("QuantoQuantizer", "1.0.0", deprecation_message) + if not is_optimum_quanto_available(): raise ImportError( "Loading an optimum-quanto quantized model requires optimum-quanto library (`pip install optimum-quanto`)"