diff --git a/src/diffusers/quantizers/base.py b/src/diffusers/quantizers/base.py index ffa654c98c..357d920d29 100644 --- a/src/diffusers/quantizers/base.py +++ b/src/diffusers/quantizers/base.py @@ -227,3 +227,8 @@ class DiffusersQuantizer(ABC): @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 689d8e4256..0dfdff019b 100644 --- a/src/diffusers/quantizers/bitsandbytes/bnb_quantizer.py +++ b/src/diffusers/quantizers/bitsandbytes/bnb_quantizer.py @@ -564,6 +564,10 @@ class BnB8BitDiffusersQuantizer(DiffusersQuantizer): # 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 b3e10b1c32..aa5ebf5711 100644 --- a/src/diffusers/quantizers/gguf/gguf_quantizer.py +++ b/src/diffusers/quantizers/gguf/gguf_quantizer.py @@ -146,6 +146,10 @@ class GGUFQuantizer(DiffusersQuantizer): 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 0120163804..c5f71f816f 100644 --- a/src/diffusers/quantizers/quanto/quanto_quantizer.py +++ b/src/diffusers/quantizers/quanto/quanto_quantizer.py @@ -175,3 +175,7 @@ class QuantoQuantizer(DiffusersQuantizer): @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 def7ee33e3..c12513f061 100644 --- a/src/diffusers/quantizers/torchao/torchao_quantizer.py +++ b/src/diffusers/quantizers/torchao/torchao_quantizer.py @@ -335,3 +335,7 @@ class TorchAoHfQuantizer(DiffusersQuantizer): @property def is_trainable(self): return self.quantization_config.quant_type.startswith("int8") + + @property + def is_compileable(self) -> bool: + return True