code: def initialize_model(config, ckpt):
      config = OmegaConf.load(config)
      model = instantiate_from_config(config.model)
      model.load_state_dict(
          torch.load(ckpt)["state_dict"], strict=False
      )
  
      device = (
          torch.device("cuda")
          if torch.cuda.is_available()
          else torch.device("cpu")
      )
      model = model.to(device)
      sampler = DDIMSampler(model)
      return sampler
  
file_path: stablediffusion/scripts/gradio/depth2img.py
imports: import sys
  import torch
  import numpy
  import gradio
  from PIL import Image
  from omegaconf import OmegaConf
  from einops import repeat, rearrange
  from pytorch_lightning import seed_everything
  from imwatermark import WatermarkEncoder
  from scripts.txt2img import put_watermark
  from ldm.util import instantiate_from_config
  from ldm.models.diffusion.ddim import DDIMSampler
  from ldm.data.util import AddMiDaS
label_desc: Use image node_id 1 for calling a global function with example usage: initialize_model(config, ckpt) and returns: sampler