code: def convert_hifigan_checkpoint(checkpoint, config):
      """
      Takes a state dict and config, and returns a converted HiFiGAN vocoder checkpoint.
      """
      # extract state dict for vocoder
      vocoder_state_dict = {}
      vocoder_key = "first_stage_model.vocoder."
      keys = list(checkpoint.keys())
      for key in keys:
          if key.startswith(vocoder_key):
              vocoder_state_dict[
                  key.replace(vocoder_key, "")
              ] = checkpoint.get(key)
  
      # fix upsampler keys, everything else is correct already
      for i in range(len(config.upsample_rates)):
          vocoder_state_dict[
              f"upsampler.{i}.weight"
          ] = vocoder_state_dict.pop(f"ups.{i}.weight")
          vocoder_state_dict[
              f"upsampler.{i}.bias"
          ] = vocoder_state_dict.pop(f"ups.{i}.bias")
  
      if not config.normalize_before:
          # if we don't set normalize_before then these variables are unused, so we set them to their initialised values
          vocoder_state_dict["mean"] = torch.zeros(config.model_in_dim)
          vocoder_state_dict["scale"] = torch.ones(config.model_in_dim)
  
      return vocoder_state_dict
  
imports: import argparse
  import re
  import torch
  from transformers import AutoTokenizer, ClapTextConfig, ClapTextModelWithProjection, SpeechT5HifiGan, SpeechT5HifiGanConfig
  from diffusers import AudioLDMPipeline, AutoencoderKL, DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, HeunDiscreteScheduler, LMSDiscreteScheduler, PNDMScheduler, UNet2DConditionModel
  from diffusers.utils import is_omegaconf_available
  from diffusers.utils.import_utils import BACKENDS_MAPPING
label_desc: Use image node_id 15 for calling a global function with example usage: convert_hifigan_checkpoint(checkpoint, config) and returns: vocoder_state_dict