Skip to content

Commit 14cb8e8

Browse files
committed
fix style
Signed-off-by: shanjiaz <[email protected]>
1 parent a07990b commit 14cb8e8

File tree

6 files changed

+13
-10
lines changed

6 files changed

+13
-10
lines changed

src/llmcompressor/core/lifecycle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def initialize(
9696
recipe=recipe, target_stage=recipe_stage, override_args=recipe_args
9797
)
9898
self.modifiers = self.recipe.create_modifier()
99-
99+
breakpoint()
100100
mod_data = []
101101
for mod in self.modifiers:
102102
data = mod.initialize(state=self.state, **kwargs)

src/llmcompressor/pipelines/registry.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ def from_modifiers(
4242
:param user: pipeline name passed by user
4343
:return: CalibrationPipeline instance to be called with data (if not datafree)
4444
"""
45-
4645
user = standardize_lookup_name(user) if user else None
4746
inferred = standardize_lookup_name(cls._validate_infer_pipeline(modifiers))
4847
independent = standardize_lookup_name("independent")

src/llmcompressor/pipelines/sequential/helpers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,7 @@ def get_targets_from_modifiers(
432432
sequential_modifiers = [
433433
modifier for modifier in modifiers if isinstance(modifier, SEQUENTIAL_MODIFIERS)
434434
]
435+
435436
if len(sequential_modifiers) >= 2:
436437
types = [type(modifier) for modifier in sequential_modifiers]
437438
logger.warning(

src/llmcompressor/recipe/recipe.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
from llmcompressor.recipe.utils import (
1111
_load_json_or_yaml_string,
1212
_parse_recipe_from_md,
13-
get_yaml_serializable_dict,
1413
deep_merge_dicts,
14+
get_yaml_serializable_dict,
1515
)
1616

1717
__all__ = [
@@ -251,6 +251,7 @@ def create_modifier(self) -> List[Modifier]:
251251
if isinstance(modifier, Modifier)
252252
else ModifierFactory.create(
253253
modifier["type"],
254+
group=modifier.get("group"),
254255
allow_registered=True,
255256
allow_experimental=True,
256257
**modifier["args"],
@@ -272,18 +273,19 @@ def yaml(
272273
existing_recipe_path: Optional[str] = None,
273274
) -> str:
274275
"""
275-
Return a YAML string representation of the recipe, optionally merging with another YAML file.
276+
Return a YAML string representation of the recipe,
277+
optionally merging with another YAML file.
276278
277279
:param file_path: Optional path to save YAML
278280
:param existing_recipe_path: Optional path to another recipe.yaml file
279281
:return: Combined YAML string
280282
"""
281283
# Load the other recipe from file, if given
282-
other_dict = {}
284+
existing_dict = {}
283285
if existing_recipe_path:
284286
with open(existing_recipe_path, "r") as f:
285287
existing_recipe_str = f.read()
286-
other_dict = _load_json_or_yaml_string(existing_recipe_str)
288+
existing_dict = _load_json_or_yaml_string(existing_recipe_str)
287289

288290
# Serialize current recipe
289291
self_dict = get_yaml_serializable_dict(
@@ -292,7 +294,7 @@ def yaml(
292294
)
293295

294296
# Deep merge — keep both recipe contents
295-
merged_dict = deep_merge_dicts(other_dict, self_dict)
297+
merged_dict = deep_merge_dicts(existing_dict, self_dict)
296298

297299
# Dump YAML
298300
file_stream = None if file_path is None else open(file_path, "w")
@@ -304,7 +306,7 @@ def yaml(
304306
default_flow_style=None,
305307
width=88,
306308
)
307-
309+
308310
if file_stream:
309311
file_stream.close()
310312

src/llmcompressor/recipe/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ def get_yaml_serializable_dict(modifiers: List[Modifier], stage: str) -> Dict[st
9797

9898
return stage_dict
9999

100+
100101
def deep_merge_dicts(d1: dict, d2: dict) -> dict:
101102
"""
102103
Recursively merge d2 into d1.

src/llmcompressor/transformers/sparsification/compressed_tensors_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,10 +293,10 @@ def update_and_save_recipe(model_stub: str, save_directory: str):
293293
existing recipe
294294
:param save_directory: path to save combined existing recipe and current recipe
295295
"""
296-
296+
297297
existing_recipe = infer_recipe_from_model_path(model_stub)
298298

299299
recipe = active_session().lifecycle.recipe
300-
300+
301301
recipe_path = os.path.join(save_directory, RECIPE_FILE_NAME)
302302
recipe.yaml(file_path=recipe_path, existing_recipe_path=existing_recipe)

0 commit comments

Comments
 (0)