77from compressed_tensors .utils import (
88 align_modules ,
99 get_execution_device ,
10- get_lowest_common_ancestor_name ,
1110 match_modules_set ,
1211 match_named_modules ,
1312 update_offload_parameter ,
3231from llmcompressor .utils .fsdp .helpers import get_fsdp_parent
3332from llmcompressor .utils .helpers import calibration_forward_context
3433from llmcompressor .utils .pytorch .module import (
35- get_module_to_name_dict , get_layer_by_name
34+ get_layer_by_name ,
35+ get_module_to_name_dict ,
3636)
3737
3838__all__ = ["AWQModifier" ]
@@ -329,7 +329,7 @@ def _set_resolved_mappings(self, model: Module) -> None:
329329 for smooth_layers , * nested_balance_layers in match_modules_set (
330330 model , (mapping .smooth_layer , * mapping .balance_layers ), self .ignore
331331 ):
332- if len (smooth_layers )> 1 :
332+ if len (smooth_layers ) > 1 :
333333 raise ValueError (
334334 "AWQ needs to match a single smoothlayer for each mapping but "
335335 f"got { [module_to_name .get (s ) for s in smooth_layers ]} "
@@ -738,6 +738,7 @@ def _check_layers_are_compatible(
738738 return False
739739 return True
740740
741+
741742def get_lowest_ancestor_with_avoid (name : str , model : Module , avoid = torch .nn .Module ):
742743 """
743744 get lowest ancestor that is not the avoided class/type
@@ -756,6 +757,7 @@ def get_lowest_ancestor_with_avoid(name: str, model: Module, avoid=torch.nn.Modu
756757 return name , ancestor
757758 name = "." .join (name .split ("." )[:- 1 ])
758759
760+
759761def _pseudo_quantize_tensor (
760762 w : torch .Tensor , symmetric : bool = False , bit_width : int = 8 , group_size : int = - 1
761763):
0 commit comments