code: def freeze_modules(model, modules):
      """Freeze model parameters according to modules list.
  
      Args:
          model (torch.nn.Module): Main model.
          modules (List): Specified module(s) to freeze.
  
      Return:
          model (torch.nn.Module) : Updated main model.
          model_params (filter): Filtered model parameters.
  
      """
      for mod, param in model.named_parameters():
          if any(mod.startswith(m) for m in modules):
              logging.warning(
                  f"Freezing {mod}. It will not be updated during training."
              )
              param.requires_grad = False
  
      model_params = filter(
          lambda x: x.requires_grad, model.parameters()
      )
  
      return model, model_params
  
file_path: espnet/espnet/asr/pytorch_backend/asr_init.py
imports: import logging
  import os
  import re
  from collections import OrderedDict
  import torch
  from espnet.asr.asr_utils import get_model_conf, torch_load
  from espnet.nets.asr_interface import ASRInterface
  from espnet.nets.mt_interface import MTInterface
  from espnet.nets.pytorch_backend.transducer.utils import custom_torch_load
  from espnet.nets.tts_interface import TTSInterface
  from espnet.utils.dynamic_import import dynamic_import
label_desc: Use image node_id 1 for calling a global function with example usage: freeze_modules(model, modules) and returns: model,  model_params