code: def check_vocabulary(asr_model, cfg):
      """
      Checks if the decoder and vocabulary of the model needs to be updated.
      If either of them needs to be updated, it updates them and returns the updated model.
      else vocabulary will be reused from the pre-trained model.
      Args:
          asr_model: ASRModel instance
          cfg: config
      Returns:
          asr_model: ASRModel instance with updated decoder and vocabulary
      """
      if (
          hasattr(cfg.model.tokenizer, "update_tokenizer")
          and cfg.model.tokenizer.update_tokenizer
      ):
          if (
              hasattr(cfg.model.char_labels, "update_labels")
              and cfg.model.char_labels.update_labels
          ):
              raise ValueError(
                  "Both `model.tokenizer.update_tokenizer` and `model.char_labels.update_labels` cannot be passed together"
              )
          else:
              asr_model = update_tokenizer(
                  asr_model,
                  cfg.model.tokenizer.dir,
                  cfg.model.tokenizer.type,
              )
      elif (
          hasattr(cfg.model, "char_labels")
          and cfg.model.char_labels.update_labels
      ):
          asr_model.change_vocabulary(
              new_vocabulary=cfg.model.char_labels.labels
          )
          logging.warning(
              "The vocabulary of the model has been updated with provided char labels."
          )
      else:
          logging.info(
              "Reusing the vocabulary from the pre-trained model."
          )
  
      return asr_model
  
file_path: NeMo/examples/asr/speech_to_text_finetune.py
imports: import time
  import pytorch_lightning
  from omegaconf import OmegaConf
  from nemo.collections.asr.models import ASRModel
  from nemo.core.config import hydra_runner
  from nemo.utils import logging, model_utils
  from nemo.utils.exp_manager import exp_manager
  from nemo.utils.get_rank import is_global_rank_zero
label_desc: Use image node_id 2 for calling a global function with example usage: check_vocabulary(asr_model, cfg) and returns: asr_model