code: def __init__(
      self,
      checkpoint,
      sampler_type="DDIM",
      t_range=[0.02, 0.98],
      precision="16",
      device=torch.device("cuda"),
  ):
      super().__init__()
  
      self.device = device
      self.checkpoint = checkpoint
      self.sampler_type = sampler_type
  
      cfg, state_dict = self.load_config_and_state_from_nemo(checkpoint)
  
      cfg.precision = precision
      cfg.ckpt_path = None
      cfg.unet_config.from_pretrained = None
      cfg.first_stage_config.from_pretrained = None
  
      self.model = LatentDiffusion(cfg).to(device)
  
      sd_state_dict = {}
      # Remove Megatron wrapper and inductor
      for key, value in state_dict.items():
          key = key[6:]
          sd_state_dict[key] = value
      self.model.load_state_dict(sd_state_dict)
      self.first_stage_model = self.model.first_stage_model
      self.text_encoder = self.model.cond_stage_model.encode
  
      self.num_train_timesteps = self.model.num_timesteps
      self.min_step = int(self.num_train_timesteps * t_range[0])
      self.max_step = int(self.num_train_timesteps * t_range[1])
      self.alphas = self.model.alphas_cumprod.to(self.device)
  
file_path: NeMo/nemo/collections/multimodal/modules/nerf/guidance/stablediffusion_nemo_pipeline.py
imports: import os
  import tempfile
  import torch
  import torch.nn.functional
  from omegaconf import OmegaConf
  from nemo.collections.multimodal.models.text_to_image.stable_diffusion.ldm.ddpm import LatentDiffusion
  from nemo.collections.multimodal.modules.nerf.guidance.txt2img_guidance_base import Txt2ImgGuidanceBase
  from nemo.collections.multimodal.modules.stable_diffusion.distributions.distributions import DiagonalGaussianDistribution
  from nemo.collections.nlp.parts.nlp_overrides import NLPSaveRestoreConnector
label_desc: Use image node_id 1 to create a new StableDiffusion object from inherited base classes: Txt2ImgGuidanceBase with example: obj = StableDiffusion(checkpoint, sampler_type, t_range, precision, device)