code: def set_init_dict(model_dict, checkpoint_state, c):
      # Partial initialization: if there is a mismatch with new and old layer, it is skipped.
      for k, v in checkpoint_state.items():
          if k not in model_dict:
              print(
                  " | > Layer missing in the model definition: {}".format(
                      k
                  )
              )
      # 1. filter out unnecessary keys
      pretrained_dict = {
          k: v for k, v in checkpoint_state.items() if k in model_dict
      }
      # 2. filter out different size layers
      pretrained_dict = {
          k: v
          for k, v in pretrained_dict.items()
          if v.numel() == model_dict[k].numel()
      }
      # 3. skip reinit layers
      if c.has("reinit_layers") and c.reinit_layers is not None:
          for reinit_layer_name in c.reinit_layers:
              pretrained_dict = {
                  k: v
                  for k, v in pretrained_dict.items()
                  if reinit_layer_name not in k
              }
      # 4. overwrite entries in the existing state dict
      model_dict.update(pretrained_dict)
      print(
          " | > {} / {} layers are restored.".format(
              len(pretrained_dict), len(model_dict)
          )
      )
      return model_dict
  
imports: import torch
  import torchaudio
  from torch import nn
  from torch.nn import Conv1d, ConvTranspose1d
  from torch.nn import functional
  from torch.nn.utils.parametrizations import weight_norm
  from torch.nn.utils.parametrize import remove_parametrizations
  from TTS.utils.io import load_fsspec
label_desc: Use image node_id 2 for calling a global function with example usage: set_init_dict(model_dict, checkpoint_state, c) and returns: model_dict