Skip to content

Commit dd33069

Browse files
minor rename
Signed-off-by: Keval Morabia <28916987+kevalmorabia97@users.noreply.github.com>
1 parent 6d151ef commit dd33069

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

nemo/collections/llm/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
PruningConfig,
4343
QuantizationConfig,
4444
Quantizer,
45-
prune_gpt_model,
45+
prune_language_model,
4646
save_pruned_model,
4747
set_modelopt_spec_if_exists_in_ckpt,
4848
setup_trainer_and_restore_model_with_modelopt_spec,
@@ -377,7 +377,7 @@ def prune(
377377
trainer_kwargs={"max_steps": steps, "limit_val_batches": steps, "val_check_interval": steps},
378378
model_config_overrides={"sequence_parallel": False},
379379
)
380-
prune_gpt_model(model, pruning_config, data, trainer)
380+
prune_language_model(model, pruning_config, data, trainer)
381381
save_pruned_model(trainer, save_path)
382382

383383
console = Console()

nemo/collections/llm/modelopt/prune/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414

1515
"""Prune utilities for using TensorRT Model Optimizer."""
1616

17-
from .pruner import PruningConfig, prune_gpt_model, save_pruned_model
17+
from .pruner import PruningConfig, prune_language_model, save_pruned_model
1818

19-
__all__ = ["PruningConfig", "prune_gpt_model", "save_pruned_model"]
19+
__all__ = ["PruningConfig", "prune_language_model", "save_pruned_model"]

nemo/collections/llm/modelopt/prune/pruner.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,13 @@ def __post_init__(self):
8181
raise ValueError("drop_layers cannot be used with other pruning parameters")
8282

8383

84-
def prune_gpt_model(
84+
def prune_language_model(
8585
model: llm.GPTModel,
8686
pruning_config: PruningConfig,
8787
data_module: pl.LightningDataModule | None = None,
8888
trainer: nl.Trainer | None = None,
8989
) -> llm.GPTModel:
90-
"""Prune a GPT model in-place based on the provided pruning configuration.
90+
"""Prune a GPT / Mamba (sub-class of GPT) model in-place based on the provided pruning configuration.
9191
9292
Args:
9393
model (llm.GPTModel): The model to prune.
@@ -101,7 +101,7 @@ def prune_gpt_model(
101101
llm.GPTModel: The pruned model.
102102
"""
103103
if pruning_config.drop_layers:
104-
mtp.plugins.drop_mcore_gpt_layers(model, layers_to_drop=pruning_config.drop_layers)
104+
mtp.plugins.drop_mcore_language_model_layers(model, layers_to_drop=pruning_config.drop_layers)
105105
else:
106106
assert data_module is not None, "data_module is required to prune the model."
107107
assert trainer is not None, "trainer is required to prune the model."
@@ -116,7 +116,7 @@ def prune_gpt_model(
116116
}
117117
mtp.prune(
118118
model,
119-
mode="mcore_gpt_minitron",
119+
mode="mcore_minitron",
120120
constraints={"export_config": export_config},
121121
dummy_input=None, # Not used
122122
config={"forward_loop": partial(llm.validate, data=data_module, trainer=trainer, tokenizer="model")},

requirements/requirements_nlp.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ megatron_core
1313
multi-storage-client>=0.21.0
1414
nltk>=3.6.5
1515
numpy<2 # tensorstore has an implicit compiled dependency on numpy<2
16-
nvidia-modelopt[torch]==0.35.0
16+
nvidia-modelopt==0.35.0
1717
nvidia-resiliency-ext>=0.3.0,<1.0.0; platform_system != 'Darwin'
1818
nvtx
1919
opencc

0 commit comments

Comments
 (0)