Skip to content

Commit 320f4ae

Browse files
committed
formatting
Summary Signed-off-by: HDCharles <charlesdavidhernandez@gmail.com>
1 parent af7d76e commit 320f4ae

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/llmcompressor/modifiers/awq/base.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from 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,
@@ -32,7 +31,8 @@
3231
from llmcompressor.utils.fsdp.helpers import get_fsdp_parent
3332
from llmcompressor.utils.helpers import calibration_forward_context
3433
from 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+
741742
def 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+
759761
def _pseudo_quantize_tensor(
760762
w: torch.Tensor, symmetric: bool = False, bit_width: int = 8, group_size: int = -1
761763
):

src/llmcompressor/modifiers/smoothquant/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ def _resolve_mappings(self, model: Module) -> List[SmoothQuantMapping]:
204204
for *nested_balance_layers, smooth_layers in match_modules_set(
205205
model, tree_leaves(mapping), self.ignore
206206
):
207-
if len(smooth_layers)>1:
208-
raise ValueError (
207+
if len(smooth_layers) > 1:
208+
raise ValueError(
209209
"SmoothQuant must match a single smooth layer for each mapping"
210210
f" but got {[module_to_name.get(s) for s in smooth_layers]}"
211211
f" for mapping: {mapping}"

0 commit comments

Comments
 (0)