code: def legacy_model_config_to_new_model_config(
      model_cfg: DictConfig,
  ) -> DictConfig:
      """
      Transform old style config into
      :class:`~nemo.collections.nlp.models.token_classification.punctuation_capitalization_config.PunctuationCapitalizationModelConfig`.
      Old style configs are configs which were used before ``common_dataset_parameters`` item was added. Old style
      datasets use ``dataset`` instead of ``common_dataset_parameters``, ``batch_size`` instead of ``tokens_in_batch``.
      Old style configs do not support tarred datasets.
  
      Args:
          model_cfg: old style config
  
      Returns:
          model config which follows dataclass
              :class:`~nemo.collections.nlp.models.token_classification.punctuation_capitalization_config.PunctuationCapitalizationModelConfig`
      """
      train_ds = model_cfg.get("train_ds")
      validation_ds = model_cfg.get("validation_ds")
      test_ds = model_cfg.get("test_ds")
      dataset = model_cfg.dataset
      punct_head_config = model_cfg.get("punct_head", {})
      capit_head_config = model_cfg.get("capit_head", {})
      omega_conf = OmegaConf.structured(
          PunctuationCapitalizationModelConfig(
              class_labels=model_cfg.class_labels,
              common_dataset_parameters=CommonDatasetParametersConfig(
                  pad_label=dataset.pad_label,
                  ignore_extra_tokens=dataset.get(
                      "ignore_extra_tokens",
                      CommonDatasetParametersConfig.ignore_extra_tokens,
                  ),
                  ignore_start_end=dataset.get(
                      "ignore_start_end",
                      CommonDatasetParametersConfig.ignore_start_end,
                  ),
                  punct_label_ids=model_cfg.punct_label_ids,
                  capit_label_ids=model_cfg.capit_label_ids,
              ),
              train_ds=None
              if train_ds is None
              else legacy_data_config_to_new_data_config(
                  train_ds, dataset, train=True
              ),
              validation_ds=None
              if validation_ds is None
              else legacy_data_config_to_new_data_config(
                  validation_ds, dataset, train=False
              ),
              test_ds=None
              if test_ds is None
              else legacy_data_config_to_new_data_config(
                  test_ds, dataset, train=False
              ),
              punct_head=HeadConfig(
                  num_fc_layers=punct_head_config.get(
                      "punct_num_fc_layers", HeadConfig.num_fc_layers
                  ),
                  fc_dropout=punct_head_config.get(
                      "fc_dropout", HeadConfig.fc_dropout
                  ),
                  activation=punct_head_config.get(
                      "activation", HeadConfig.activation
                  ),
                  use_transformer_init=punct_head_config.get(
                      "use_transformer_init",
                      HeadConfig.use_transformer_init,
                  ),
              ),
              capit_head=HeadConfig(
                  num_fc_layers=capit_head_config.get(
                      "capit_num_fc_layers", HeadConfig.num_fc_layers
                  ),
                  fc_dropout=capit_head_config.get(
                      "fc_dropout", HeadConfig.fc_dropout
                  ),
                  activation=capit_head_config.get(
                      "activation", HeadConfig.activation
                  ),
                  use_transformer_init=capit_head_config.get(
                      "use_transformer_init",
                      HeadConfig.use_transformer_init,
                  ),
              ),
              tokenizer=model_cfg.tokenizer,
              language_model=model_cfg.language_model,
              optim=model_cfg.optim,
          )
      )
      with open_dict(omega_conf):
          retain_during_legacy_conversion = model_cfg.get(
              "retain_during_legacy_conversion", {}
          )
          for key in retain_during_legacy_conversion.keys():
              omega_conf[key] = retain_during_legacy_conversion[key]
      return omega_conf
  
imports: from dataclasses import dataclass, field
  from typing import Any, Dict, Optional
  from omegaconf.omegaconf import MISSING, DictConfig, OmegaConf, open_dict
  from nemo.collections.common.parts.adapter_modules import LinearAdapterConfig
  from nemo.collections.nlp.data.token_classification.punctuation_capitalization_dataset import PunctuationCapitalizationEvalDataConfig, PunctuationCapitalizationTrainDataConfig, legacy_data_config_to_new_data_config
  from nemo.core.config import TrainerConfig
  from nemo.core.config.modelPT import NemoConfig
  from nemo.utils.exp_manager import ExpManagerConfig
label_desc: Use image node_id 2 for calling a global function with example usage: legacy_model_config_to_new_model_config(model_cfg) and returns: omega_conf