code: def init_from_ckpt(self, path, ignore_keys=list(), only_model=False):
      pl_sd = torch.load(path, map_location="cpu")
      if "state_dict" in list(pl_sd.keys()):
          pl_sd = pl_sd["state_dict"]
      sd = {}
  
      first_key = list(pl_sd.keys())[0]
      # State keys of model trained with TorchDynamo changed from
      # "model.xxx" to "model._orig_mod.xxx"
      for k, v in pl_sd.items():
          new_k = k.replace("._orig_mod", "")
          # compatibility for stable diffusion old checkpoint
          # remove megatron wrapper prefix
          if first_key == "model.betas":
              new_k = new_k.lstrip("model.")
          sd[new_k] = v
      keys = list(sd.keys())
  
      # Our model adds additional channels to the first layer to condition on an input image.
      # For the first layer, copy existing channel weights and initialize new channel weights to zero.
      input_keys = [
          "model.diffusion_model.input_blocks.0.0.weight",
      ]
  
      self_sd = self.state_dict()
      for input_key in input_keys:
          if input_key not in sd or input_key not in self_sd:
              continue
  
          input_weight = self_sd[input_key]
          if input_weight.size() != sd[input_key].size():
              print(f"Manual init: {input_key}")
              input_weight.zero_()
              input_weight[:, :4, :, :].copy_(sd[input_key])
              ignore_keys.append(input_key)
  
      for k in keys:
          for ik in ignore_keys:
              if k.startswith(ik):
                  print("Deleting key {} from state_dict.".format(k))
                  del sd[k]
      missing, unexpected = (
          self.load_state_dict(sd, strict=False)
          if not only_model
          else self.model.load_state_dict(sd, strict=False)
      )
      print(
          f"Restored from {path} with {len(missing)} missing and {len(unexpected)} unexpected keys"
      )
      if len(missing) > 0:
          print(f"Missing Keys: {missing}")
      if len(unexpected) > 0:
          print(f"Unexpected Keys: {unexpected}")
  
file_path: NeMo/nemo/collections/multimodal/models/text_to_image/instruct_pix2pix/ldm/ddpm_edit.py
imports: import torch
  from einops import rearrange
  from nemo.collections.multimodal.data.instruct_pix2pix.edit_dataset import EditDataset
  from nemo.collections.multimodal.models.text_to_image.stable_diffusion.ldm.ddpm import LatentDiffusion, MegatronLatentDiffusion
  from nemo.collections.nlp.data.language_modeling.megatron.data_samplers import MegatronPretrainingRandomSampler, MegatronPretrainingSampler
  from nemo.utils import logging
label_desc: Use image node_id 1 for calling the LatentDiffusionEdit obj's underlying member method code with example usage: obj.init_from_ckpt(path, ignore_keys, only_model) without return types