diff --git a/src/diffusers/quantizers/base.py b/src/diffusers/quantizers/base.py index ffa654c98c2b..357d920d29c4 100644 --- a/src/diffusers/quantizers/base.py +++ b/src/diffusers/quantizers/base.py @@ -227,3 +227,8 @@ def is_serializable(self): ... @property @abstractmethod def is_trainable(self): ... + + @property + def is_compileable(self) -> bool: + """Flag indicating whether the quantized model can be compiled""" + return False diff --git a/src/diffusers/quantizers/bitsandbytes/bnb_quantizer.py b/src/diffusers/quantizers/bitsandbytes/bnb_quantizer.py index 689d8e4256c2..0dfdff019b79 100644 --- a/src/diffusers/quantizers/bitsandbytes/bnb_quantizer.py +++ b/src/diffusers/quantizers/bitsandbytes/bnb_quantizer.py @@ -564,6 +564,10 @@ def is_trainable(self) -> bool: # Because we're mandating `bitsandbytes` 0.43.3. return True + @property + def is_compileable(self) -> bool: + return True + def _dequantize(self, model): from .utils import dequantize_and_replace diff --git a/src/diffusers/quantizers/gguf/gguf_quantizer.py b/src/diffusers/quantizers/gguf/gguf_quantizer.py index b3e10b1c3246..aa5ebf5711a3 100644 --- a/src/diffusers/quantizers/gguf/gguf_quantizer.py +++ b/src/diffusers/quantizers/gguf/gguf_quantizer.py @@ -146,6 +146,10 @@ def is_serializable(self): def is_trainable(self) -> bool: return False + @property + def is_compileable(self) -> bool: + return True + def _dequantize(self, model): is_model_on_cpu = model.device.type == "cpu" if is_model_on_cpu: diff --git a/src/diffusers/quantizers/quanto/quanto_quantizer.py b/src/diffusers/quantizers/quanto/quanto_quantizer.py index 0120163804c9..c5f71f816fc3 100644 --- a/src/diffusers/quantizers/quanto/quanto_quantizer.py +++ b/src/diffusers/quantizers/quanto/quanto_quantizer.py @@ -175,3 +175,7 @@ def is_trainable(self): @property def is_serializable(self): return True + + @property + def is_compileable(self) -> bool: + return True diff --git a/src/diffusers/quantizers/torchao/torchao_quantizer.py b/src/diffusers/quantizers/torchao/torchao_quantizer.py index def7ee33e389..c12513f061da 100644 --- a/src/diffusers/quantizers/torchao/torchao_quantizer.py +++ b/src/diffusers/quantizers/torchao/torchao_quantizer.py @@ -335,3 +335,7 @@ def is_serializable(self, safe_serialization=None): @property def is_trainable(self): return self.quantization_config.quant_type.startswith("int8") + + @property + def is_compileable(self) -> bool: + return True