code: def load_vae_from_checkpoint(self, checkpoint):
      device = torch.device(
          "cuda" if torch.cuda.is_available() else "cpu"
      )
      cfg, state_dict = self.load_config_and_state_from_nemo(checkpoint)
  
      if cfg.get("unet_config") and cfg.get("unet_config").get(
          "from_pretrained"
      ):
          cfg.unet_config.from_pretrained = None
      if cfg.get("first_stage_config") and cfg.get(
          "first_stage_config"
      ).get("from_pretrained"):
          cfg.first_stage_config.from_pretrained = None
  
      model = LatentDiffusion(cfg).to(device)
  
      sd_state_dict = {}
      for key, value in state_dict.items():
          key = key[6:]
          sd_state_dict[key] = value
      model.load_state_dict(sd_state_dict)
  
      return model.first_stage_model.encode
  
imports: import logging
  import os
  import tempfile
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from omegaconf import OmegaConf
  from polygraphy import cuda
  from transformers import CLIPTokenizer
  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.nerf.utils.trt_engine import Engine, device_view
  from nemo.collections.multimodal.modules.stable_diffusion.diffusionmodules.util import extract_into_tensor, make_beta_schedule
  from nemo.collections.multimodal.parts.stable_diffusion.utils import default
  from nemo.collections.multimodal.parts.utils import randn_like
  from nemo.collections.nlp.parts.nlp_overrides import NLPSaveRestoreConnector
label_desc: Use image node_id 7 for calling the LatentDiffusionWrapper obj's underlying member method code with example usage: obj.load_vae_from_checkpoint(checkpoint) and returns: model