code: def create_unet_diffusers_config(original_config, image_size: int):
      """
      Creates a UNet config for diffusers based on the config of the original AudioLDM2 model.
      """
      unet_params = original_config["model"]["params"]["unet_config"][
          "params"
      ]
      vae_params = original_config["model"]["params"][
          "first_stage_config"
      ]["params"]["ddconfig"]
  
      block_out_channels = [
          unet_params["model_channels"] * mult
          for mult in unet_params["channel_mult"]
      ]
  
      down_block_types = []
      resolution = 1
      for i in range(len(block_out_channels)):
          block_type = (
              "CrossAttnDownBlock2D"
              if resolution in unet_params["attention_resolutions"]
              else "DownBlock2D"
          )
          down_block_types.append(block_type)
          if i != len(block_out_channels) - 1:
              resolution *= 2
  
      up_block_types = []
      for i in range(len(block_out_channels)):
          block_type = (
              "CrossAttnUpBlock2D"
              if resolution in unet_params["attention_resolutions"]
              else "UpBlock2D"
          )
          up_block_types.append(block_type)
          resolution //= 2
  
      vae_scale_factor = 2 ** (len(vae_params["ch_mult"]) - 1)
  
      cross_attention_dim = (
          list(unet_params["context_dim"])
          if "context_dim" in unet_params
          else block_out_channels
      )
      if len(cross_attention_dim) > 1:
          # require two or more cross-attention layers per-block, each of different dimension
          cross_attention_dim = [
              cross_attention_dim
              for _ in range(len(block_out_channels))
          ]
  
      config = {
          "sample_size": image_size // vae_scale_factor,
          "in_channels": unet_params["in_channels"],
          "out_channels": unet_params["out_channels"],
          "down_block_types": tuple(down_block_types),
          "up_block_types": tuple(up_block_types),
          "block_out_channels": tuple(block_out_channels),
          "layers_per_block": unet_params["num_res_blocks"],
          "transformer_layers_per_block": unet_params[
              "transformer_depth"
          ],
          "cross_attention_dim": tuple(cross_attention_dim),
      }
  
      return config
  
imports: import argparse
  import re
  from typing import List, Union
  import torch
  import yaml
  from transformers import AutoFeatureExtractor, AutoTokenizer, ClapConfig, ClapModel, GPT2Config, GPT2Model, SpeechT5HifiGan, SpeechT5HifiGanConfig, T5Config, T5EncoderModel
  from diffusers import AudioLDM2Pipeline, AudioLDM2ProjectionModel, AudioLDM2UNet2DConditionModel, AutoencoderKL, DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, HeunDiscreteScheduler, LMSDiscreteScheduler, PNDMScheduler
  from diffusers.utils import is_safetensors_available
  from diffusers.utils.import_utils import BACKENDS_MAPPING
label_desc: Use image node_id 8 for calling a global function with example usage: create_unet_diffusers_config(original_config, image_size) and returns: config