code: def create_model(
      image_size,
      num_channels,
      num_res_blocks,
      channel_mult="",
      learn_sigma=False,
      class_cond=False,
      use_checkpoint=False,
      attention_resolutions="16",
      num_heads=1,
      num_head_channels=-1,
      num_heads_upsample=-1,
      use_scale_shift_norm=False,
      dropout=0,
      resblock_updown=False,
      use_fp16=False,
      use_new_attention_order=False,
  ):
      if channel_mult == "":
          if image_size == 512:
              channel_mult = (0.5, 1, 1, 2, 2, 4, 4)
          elif image_size == 256:
              channel_mult = (1, 1, 2, 2, 4, 4)
          elif image_size == 128:
              channel_mult = (1, 1, 2, 3, 4)
          elif image_size == 64:
              channel_mult = (1, 2, 3, 4)
          else:
              raise ValueError(f"unsupported image size: {image_size}")
      else:
          channel_mult = tuple(
              int(ch_mult) for ch_mult in channel_mult.split(",")
          )
  
      attention_ds = []
      for res in attention_resolutions.split(","):
          attention_ds.append(image_size // int(res))
  
      return UNetModel(
          image_size=image_size,
          in_channels=3,
          model_channels=num_channels,
          out_channels=(3 if not learn_sigma else 6),
          num_res_blocks=num_res_blocks,
          attention_resolutions=tuple(attention_ds),
          dropout=dropout,
          channel_mult=channel_mult,
          num_classes=(NUM_CLASSES if class_cond else None),
          use_checkpoint=use_checkpoint,
          use_fp16=use_fp16,
          num_heads=num_heads,
          num_head_channels=num_head_channels,
          num_heads_upsample=num_heads_upsample,
          use_scale_shift_norm=use_scale_shift_norm,
          resblock_updown=resblock_updown,
          use_new_attention_order=use_new_attention_order,
      )
  
file_path: PaddleHub/modules/image/text_to_image/disco_diffusion_cnclip_vitb16/reverse_diffusion/model/script_util.py
imports: import argparse
  import inspect
  from .None import gaussian_diffusion
  from .respace import space_timesteps
  from .respace import SpacedDiffusion
  from .unet import EncoderUNetModel
  from .unet import SuperResModel
  from .unet import UNetModel
label_desc: Use image node_id 4 for calling a global function with example usage: create_model(image_size, num_channels, num_res_blocks, channel_mult, learn_sigma, class_cond, use_checkpoint, attention_resolutions, num_heads, num_head_channels, num_heads_upsample, use_scale_shift_norm, dropout, resblock_updown, use_fp16, use_new_attention_order) and returns: UNetModel