Skip to content

Commit 8764291

Browse files
authored
Remove log_model_load (#1016)
## Purpose ## * Remove unused code that is unlikely to be used in the future, since we're now using default transformers autoclasses to load quantized models ## Changes ## * Remove `log_model_load`, since we now prefer to load as run_compressed ## Testing ## `grep -r 'log_model_load' src/ tests/ examples/` Signed-off-by: Kyle Sayers <[email protected]>
1 parent b61092b commit 8764291

File tree

1 file changed

+0
-41
lines changed

1 file changed

+0
-41
lines changed

src/llmcompressor/pytorch/model_load/helpers.py

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@
88
from torch.nn import Module
99

1010
from llmcompressor.core import active_session, create_session, pre_initialize_structure
11-
from llmcompressor.pytorch.utils import ModuleSparsificationInfo
1211
from llmcompressor.typing import Processor
1312

1413
COMPLETED_STAGES_FILENAME = "completed_stages.json"
1514

1615
__all__ = [
17-
"log_model_load",
1816
"initialize_recipe",
1917
"save_model_and_recipe",
2018
"copy_python_files_from_model_cache",
@@ -26,45 +24,6 @@
2624
]
2725

2826

29-
def log_model_load(
30-
model: Module, model_name_or_path: str, model_type: str, delayed_load: bool
31-
):
32-
"""
33-
Log the state of a loaded model including sparsity and
34-
prunable params information.
35-
36-
:param model: the loaded model
37-
:param model_name_or_path: the original name of or path to the model that loaded
38-
:param model_type: specify the type of model loaded for logging;
39-
ex one of [model, student, teacher]
40-
:param delayed_load: True if this model load was delayed until after
41-
recipe instantiation due to QAT or other architectural state changes
42-
"""
43-
if delayed_load:
44-
logger.info(
45-
f"Delayed load of model {model_name_or_path} detected. "
46-
f"Will print out model information once LLMCompressor recipes have loaded"
47-
)
48-
return
49-
50-
sparsification_info = ModuleSparsificationInfo(model)
51-
52-
logger.info(
53-
f"Loaded {model_type} from {model_name_or_path} "
54-
f"with {sparsification_info.params_total} total params. "
55-
f"Of those there are {sparsification_info.params_prunable_total} prunable "
56-
f"params which have {sparsification_info.params_prunable_sparse_percent} "
57-
"avg sparsity."
58-
)
59-
model_type = (
60-
"sparse" if sparsification_info.params_prunable_sparse_percent > 5 else "dense"
61-
)
62-
logger.info(
63-
f"{model_type} model detected, "
64-
f"all sparsification info: {sparsification_info}"
65-
)
66-
67-
6827
def initialize_recipe(model: Module, recipe_path: str):
6928
"""
7029
Initializes a recipe that has been previously applied to the model

0 commit comments

Comments
 (0)