code: def __init__(self, cfg, model_parallel_config):
      super().__init__(
          cfg=cfg, model_parallel_config=model_parallel_config
      )
      self.control_model = ControlLDM.from_config_dict(
          cfg.control_stage_config
      )
      self.control_key = cfg.control_key
      self.only_mid_control = cfg.only_mid_control
      self.control_scales = [1.0] * 13
      self.sd_locked = cfg.sd_locked
      self.channels_last = cfg.channels_last
  
      if cfg.get("inductor", False):
          # TorchInductor with CUDA graph can lead to OOM
          inductor_config.triton.cudagraphs = cfg.get(
              "inductor_cudagraphs", False
          )
          torch._dynamo.config.dynamic_shapes = False
          torch._dynamo.config.automatic_dynamic_shapes = False
          self.control_model = torch.compile(self.control_model)
  
      if self.channels_last:
          self.control_model = self.control_model.to(
              memory_format=torch.channels_last
          )
  
imports: from typing import Any
  import einops
  import torch
  import torch.nn
  from einops import rearrange, repeat
  from omegaconf import DictConfig
  from pytorch_lightning import Trainer
  from pytorch_lightning.utilities.rank_zero import rank_zero_only
  from torch._inductor import config
  from nemo.collections.multimodal.data.controlnet.controlnet_dataset import build_train_valid_datasets
  from nemo.collections.multimodal.models.text_to_image.stable_diffusion.ldm.ddpm import LatentDiffusion
  from nemo.collections.multimodal.models.text_to_image.stable_diffusion.samplers.ddim import DDIMSampler
  from nemo.collections.multimodal.modules.stable_diffusion.attention import SpatialTransformer
  from nemo.collections.multimodal.modules.stable_diffusion.diffusionmodules.openaimodel import AttentionBlock, Downsample, ResBlock, TimestepEmbedSequential, UNetModel
  from nemo.collections.multimodal.modules.stable_diffusion.diffusionmodules.util import conv_nd, linear, timestep_embedding, zero_module
  from nemo.collections.multimodal.parts.stable_diffusion.utils import exists, log_txt_as_img
  from nemo.collections.nlp.models.language_modeling.megatron_base_model import MegatronBaseModel
  from nemo.collections.nlp.modules.common.megatron.module import Float16Module
  from nemo.utils import logging
label_desc: Use image node_id 1 to create a new ControlLDM object from inherited base classes: LatentDiffusion with example: obj = ControlLDM(cfg, model_parallel_config)