PTQ-Level Efficiency, QAT-Level Accuracy | 训练后量化的效率,量化感知训练的精度
Fix Inference tensors do not track version counter error (#1502)
Wang, Mengnie2b88a5cc6c5
diff --git a/auto_round/compressors/base.py b/auto_round/compressors/base.pyindex d56cba25d..5472c373d 100644--- a/auto_round/compressors/base.py+++ b/auto_round/compressors/base.py@@ -1367,10 +1367,10 @@ class BaseCompressor(object):not any(m.children())and len(m.state_dict()) > 0and m.global_name not in tied_weights_layers+ and self.is_immediate_saving):set_module(self.model, m.global_name, copy.deepcopy(m))- if self.is_immediate_saving:- shard_writer(self, name=m.global_name)+ shard_writer(self, name=m.global_name)m.to("meta")clear_memory(device_list=self.device_list)memory_monitor.log_summary()@@ -1401,10 +1401,14 @@ class BaseCompressor(object):clear_memory(device_list=self.device_list)memory_monitor.log_summary()- elif not any(m.children()) and len(m.state_dict()) > 0 and n not in tied_weights_layers:+ elif (+ not any(m.children())+ and len(m.state_dict()) > 0+ and n not in tied_weights_layers+ and self.is_immediate_saving+ ):set_module(self.model, n, copy.deepcopy(m))- if self.is_immediate_saving:- shard_writer(self, name=n)+ shard_writer(self, name=n)m.to("meta")# Convert remaining fp8