code: def apply_refiner(cfg_denoiser):
      completed_ratio = cfg_denoiser.step / cfg_denoiser.total_steps
      refiner_switch_at = cfg_denoiser.p.refiner_switch_at
      refiner_checkpoint_info = cfg_denoiser.p.refiner_checkpoint_info
  
      if (
          refiner_switch_at is not None
          and completed_ratio < refiner_switch_at
      ):
          return False
  
      if (
          refiner_checkpoint_info is None
          or shared.sd_model.sd_checkpoint_info
          == refiner_checkpoint_info
      ):
          return False
  
      if getattr(cfg_denoiser.p, "enable_hr", False):
          is_second_pass = cfg_denoiser.p.is_hr_pass
  
          if (
              opts.hires_fix_refiner_pass == "first pass"
              and is_second_pass
          ):
              return False
  
          if (
              opts.hires_fix_refiner_pass == "second pass"
              and not is_second_pass
          ):
              return False
  
          if opts.hires_fix_refiner_pass != "second pass":
              cfg_denoiser.p.extra_generation_params[
                  "Hires refiner"
              ] = opts.hires_fix_refiner_pass
  
      cfg_denoiser.p.extra_generation_params[
          "Refiner"
      ] = refiner_checkpoint_info.short_title
      cfg_denoiser.p.extra_generation_params[
          "Refiner switch at"
      ] = refiner_switch_at
  
      with sd_models.SkipWritingToConfig():
          sd_models.reload_model_weights(info=refiner_checkpoint_info)
  
      devices.torch_gc()
      cfg_denoiser.p.setup_conds()
      cfg_denoiser.update_inner_model()
  
      return True
  
imports: import inspect
  from collections import namedtuple
  import numpy
  import torch
  from PIL import Image
  from modules import devices, images, sd_vae_approx, sd_samplers, sd_vae_taesd, shared, sd_models
  from modules.shared import opts, state
  import k_diffusion.sampling
label_desc: Use image node_id 11 for calling a global function with example usage: apply_refiner(cfg_denoiser) and returns: True, False, False, False, False