code: def get_super_res_unet(
      unet_checkpoint_path, verify_param_count=True, sample_size=None
  ):
      orig_path = unet_checkpoint_path
  
      original_unet_config = OmegaConf.load(
          os.path.join(orig_path, "config.yml")
      )
      original_unet_config = original_unet_config.params
  
      unet_diffusers_config = superres_create_unet_diffusers_config(
          original_unet_config
      )
      unet_diffusers_config[
          "time_embedding_dim"
      ] = original_unet_config.model_channels * int(
          original_unet_config.channel_mult.split(",")[-1]
      )
      if (
          original_unet_config.encoder_dim
          != original_unet_config.encoder_channels
      ):
          unet_diffusers_config[
              "encoder_hid_dim"
          ] = original_unet_config.encoder_dim
          unet_diffusers_config["class_embed_type"] = "timestep"
          unet_diffusers_config["addition_embed_type"] = "text"
  
      unet_diffusers_config["time_embedding_act_fn"] = "gelu"
      unet_diffusers_config["resnet_skip_time_act"] = True
      unet_diffusers_config["resnet_out_scale_factor"] = 1 / 0.7071
      unet_diffusers_config["mid_block_scale_factor"] = 1 / 0.7071
      unet_diffusers_config["only_cross_attention"] = (
          bool(original_unet_config.disable_self_attentions)
          if (
              "disable_self_attentions" in original_unet_config
              and isinstance(
                  original_unet_config.disable_self_attentions, int
              )
          )
          else True
      )
  
      if sample_size is None:
          unet_diffusers_config[
              "sample_size"
          ] = original_unet_config.image_size
      else:
          # The second upscaler unet's sample size is incorrectly specified
          # in the config and is instead hardcoded in source
          unet_diffusers_config["sample_size"] = sample_size
  
      unet_checkpoint = torch.load(
          os.path.join(unet_checkpoint_path, "pytorch_model.bin"),
          map_location="cpu",
      )
  
      if verify_param_count:
          # check that architecture matches - is a bit slow
          verify_param_count(orig_path, unet_diffusers_config)
  
      converted_unet_checkpoint = superres_convert_ldm_unet_checkpoint(
          unet_checkpoint,
          unet_diffusers_config,
          path=unet_checkpoint_path,
      )
      converted_keys = converted_unet_checkpoint.keys()
  
      model = UNet2DConditionModel(**unet_diffusers_config)
      expected_weights = model.state_dict().keys()
  
      diff_c_e = set(converted_keys) - set(expected_weights)
      diff_e_c = set(expected_weights) - set(converted_keys)
  
      assert (
          len(diff_e_c) == 0
      ), f"Expected, but not converted: {diff_e_c}"
      assert (
          len(diff_c_e) == 0
      ), f"Converted, but not expected: {diff_c_e}"
  
      model.load_state_dict(converted_unet_checkpoint)
  
      return model
  
imports: import argparse
  import inspect
  import os
  import numpy
  import torch
  from torch.nn import functional
  from transformers import CLIPConfig, CLIPImageProcessor, CLIPVisionModelWithProjection, T5EncoderModel, T5Tokenizer
  from diffusers import DDPMScheduler, IFPipeline, IFSuperResolutionPipeline, UNet2DConditionModel
  from diffusers.pipelines.deepfloyd_if.safety_checker import IFSafetyChecker
label_desc: Use image node_id 16 for calling a global function with example usage: get_super_res_unet(unet_checkpoint_path, verify_param_count, sample_size) and returns: model