Skip to content

PTQ-Level Efficiency, QAT-Level Accuracy | 训练后量化的效率,量化感知训练的精度

fix: recreate calibrator for secondary diffusion transformers (#2335)

Wang, Changcea5abd75414
diff --git a/auto_round/compressors/diffusion_mixin.py b/auto_round/compressors/diffusion_mixin.py
index 1b285138c..5228c80a6 100644
--- a/auto_round/compressors/diffusion_mixin.py
+++ b/auto_round/compressors/diffusion_mixin.py
@@ -352,6 +352,9 @@ class DiffusionMixin:
self.model_context.model = transformer
self.model_context.quantized = False
self._post_init_done = False
+ # Calibrators snapshot the active model at construction time. Recreate
+ # it so transformer_2 block hooks are not installed on the primary model.
+ self.calibration = None
# Dispatch the pipeline for the secondary transformer without recasting it.
self._align_device_and_dtype_for_secondary(comp_name)