code: def init_from_ckpt(self, path, ignore_keys=list(), only_model=False):
      sd = torch.load(path, map_location="cpu")
      if "state_dict" in list(sd.keys()):
          sd = sd["state_dict"]
      keys = list(sd.keys())
      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}")
  
imports: import os
  from copy import deepcopy
  from glob import glob
  import lightning.pytorch
  import torch
  from einops import rearrange
  from ldm.lr_scheduler import LambdaLinearScheduler
  from ldm.models.diffusion.ddpm import LatentDiffusion
  from ldm.modules.diffusionmodules.openaimodel import EncoderUNetModel, UNetModel
  from ldm.util import default, ismap, log_txt_as_img
  from natsort import natsorted
  from omegaconf import OmegaConf
  from torch.nn import functional
  from torch.optim import AdamW
  from torch.optim.lr_scheduler import LambdaLR
label_desc: Use image node_id 2 for calling the NoisyLatentImageClassifier obj's underlying member method code with example usage: obj.init_from_ckpt(path, ignore_keys, only_model) without return types