Skip to content

Commit 48eae6f

Browse files
authored
[Quantizers] add is_compileable property to quantizers. (#11736)
add is_compileable property to quantizers.
1 parent 66394bf commit 48eae6f

File tree

5 files changed

+21
-0
lines changed

5 files changed

+21
-0
lines changed

src/diffusers/quantizers/base.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,3 +227,8 @@ def is_serializable(self): ...
227227
@property
228228
@abstractmethod
229229
def is_trainable(self): ...
230+
231+
@property
232+
def is_compileable(self) -> bool:
233+
"""Flag indicating whether the quantized model can be compiled"""
234+
return False

src/diffusers/quantizers/bitsandbytes/bnb_quantizer.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,10 @@ def is_trainable(self) -> bool:
564564
# Because we're mandating `bitsandbytes` 0.43.3.
565565
return True
566566

567+
@property
568+
def is_compileable(self) -> bool:
569+
return True
570+
567571
def _dequantize(self, model):
568572
from .utils import dequantize_and_replace
569573

src/diffusers/quantizers/gguf/gguf_quantizer.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ def is_serializable(self):
146146
def is_trainable(self) -> bool:
147147
return False
148148

149+
@property
150+
def is_compileable(self) -> bool:
151+
return True
152+
149153
def _dequantize(self, model):
150154
is_model_on_cpu = model.device.type == "cpu"
151155
if is_model_on_cpu:

src/diffusers/quantizers/quanto/quanto_quantizer.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,3 +175,7 @@ def is_trainable(self):
175175
@property
176176
def is_serializable(self):
177177
return True
178+
179+
@property
180+
def is_compileable(self) -> bool:
181+
return True

src/diffusers/quantizers/torchao/torchao_quantizer.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,3 +335,7 @@ def is_serializable(self, safe_serialization=None):
335335
@property
336336
def is_trainable(self):
337337
return self.quantization_config.quant_type.startswith("int8")
338+
339+
@property
340+
def is_compileable(self) -> bool:
341+
return True

0 commit comments

Comments
 (0)