nemo_automodel.utils.model_utils#

Module Contents#

Functions#

print_trainable_parameters

Print the number of trainable parameters in the model.

_freeze_module_by_attribute_and_patterns

Helper function to freeze parameters by attribute name and name patterns.

apply_parameter_freezing

Apply parameter freezing based on configuration.

Data#

API#

nemo_automodel.utils.model_utils.logger#

‘getLogger(…)’

nemo_automodel.utils.model_utils.print_trainable_parameters(model)[source]#

Print the number of trainable parameters in the model.

Parameters:

model – Model to analyze

nemo_automodel.utils.model_utils._freeze_module_by_attribute_and_patterns(
model,
attribute_name,
name_patterns,
)[source]#

Helper function to freeze parameters by attribute name and name patterns.

Parameters:
  • model – The model to apply freezing to.

  • attribute_name – Name of the model attribute to freeze (e.g., ‘vision_tower’).

  • name_patterns – List of patterns to match in module names.

nemo_automodel.utils.model_utils.apply_parameter_freezing(model, freeze_config)[source]#

Apply parameter freezing based on configuration.

Parameters:
  • model – The model to apply freezing to.

  • freeze_config – Configuration dict specifying what to freeze.

freeze_config can contain: - freeze_embeddings: bool (default True) - freeze_vision_tower: bool (default False) - freeze_language_model: bool (default False)