class_docstr: HiFi-GAN model (https://arxiv.org/abs/2010.05646) that is used to generate audio from mel spectrogram.
class_docstr_tok: ["HiFi-GAN","model","(","https",":","\/\/arxiv.org\/abs\/2010.05646",")","that","is","used","to","generate","audio","from","mel","spectrogram","."]
code: def load_state_dict(self, state_dict, strict=True):
      # Override load_state_dict to give us some flexibility to be backward-compatible with old checkpoints
      new_state_dict = {}
      num_resblocks = len(
          self.cfg["generator"]["resblock_kernel_sizes"]
      )
      for k, v in state_dict.items():
          new_k = k
          if "resblocks" in k:
              parts = k.split(".")
              # only do this is the checkpoint type is older
              if len(parts) == 6:
                  layer = int(parts[2])
                  new_layer = f"{layer // num_resblocks}.{layer % num_resblocks}"
                  new_k = f"generator.resblocks.{new_layer}.{'.'.join(parts[3:])}"
          new_state_dict[new_k] = v
      super().load_state_dict(new_state_dict, strict=strict)
  
imports: import itertools
  from pathlib import Path
  import torch
  import torch.nn.functional
  from hydra.utils import instantiate
  from omegaconf import DictConfig, OmegaConf, open_dict
  from pytorch_lightning.loggers.wandb import WandbLogger
  from nemo.collections.tts.losses.hifigan_losses import DiscriminatorLoss, FeatureMatchingLoss, GeneratorLoss
  from nemo.collections.tts.models.base import Vocoder
  from nemo.collections.tts.modules.hifigan_modules import MultiPeriodDiscriminator, MultiScaleDiscriminator
  from nemo.collections.tts.parts.utils.callbacks import LoggingCallback
  from nemo.collections.tts.parts.utils.helpers import get_batch_size, get_num_workers, plot_spectrogram_to_numpy
  from nemo.core.classes import Exportable
  from nemo.core.classes.common import PretrainedModelInfo, typecheck
  from nemo.core.neural_types.elements import AudioSignal, MelSpectrogramType
  from nemo.core.neural_types.neural_type import NeuralType
  from nemo.core.optim.lr_scheduler import compute_max_steps, prepare_lr_scheduler
  from nemo.utils import logging, model_utils
label_desc: Use image node_id 21 for calling the HifiGanModel obj's underlying member method code with example usage: obj.load_state_dict(state_dict, strict) without return types