Skip to content

Commit 897aed7

Browse files
authored
[Quantization] Deprecate Quanto (#13180)
* update * update
1 parent 07a63e1 commit 897aed7

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/diffusers/quantizers/quantization_config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
from packaging import version
3838

39-
from ..utils import is_torch_available, is_torchao_available, is_torchao_version, logging
39+
from ..utils import deprecate, is_torch_available, is_torchao_available, is_torchao_version, logging
4040

4141

4242
if is_torch_available():
@@ -844,6 +844,8 @@ def __init__(
844844
modules_to_not_convert: list[str] | None = None,
845845
**kwargs,
846846
):
847+
deprecation_message = "`QuantoConfig` is deprecated and will be removed in version 1.0.0."
848+
deprecate("QuantoConfig", "1.0.0", deprecation_message)
847849
self.quant_method = QuantizationMethod.QUANTO
848850
self.weights_dtype = weights_dtype
849851
self.modules_to_not_convert = modules_to_not_convert

src/diffusers/quantizers/quanto/quanto_quantizer.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from diffusers.utils.import_utils import is_optimum_quanto_version
44

55
from ...utils import (
6+
deprecate,
67
get_module_from_name,
78
is_accelerate_available,
89
is_accelerate_version,
@@ -42,6 +43,9 @@ def __init__(self, quantization_config, **kwargs):
4243
super().__init__(quantization_config, **kwargs)
4344

4445
def validate_environment(self, *args, **kwargs):
46+
deprecation_message = "The Quanto quantizer is deprecated and will be removed in version 1.0.0."
47+
deprecate("QuantoQuantizer", "1.0.0", deprecation_message)
48+
4549
if not is_optimum_quanto_available():
4650
raise ImportError(
4751
"Loading an optimum-quanto quantized model requires optimum-quanto library (`pip install optimum-quanto`)"

0 commit comments

Comments
 (0)