code: def apply_model(self, *args, **kwargs):
      if len(args) == 3:
          encoder_hidden_states = args[-1]
          args = args[:2]
      if kwargs.get("cond", None) is not None:
          encoder_hidden_states = kwargs.pop("cond")
      return self.model(
          *args, encoder_hidden_states=encoder_hidden_states, **kwargs
      ).sample
  
imports: import importlib
  import inspect
  from typing import Callable, List, Optional, Union
  import torch
  from k_diffusion.external import CompVisDenoiser, CompVisVDenoiser
  from k_diffusion.sampling import BrownianTreeNoiseSampler, get_sigmas_karras
  from ...image_processor import VaeImageProcessor
  from ...loaders import LoraLoaderMixin, TextualInversionLoaderMixin
  from ...models.lora import adjust_lora_scale_text_encoder
  from ...schedulers import LMSDiscreteScheduler
  from ...utils import USE_PEFT_BACKEND, deprecate, logging, scale_lora_layers, unscale_lora_layers
  from ...utils.torch_utils import randn_tensor
  from ..pipeline_utils import DiffusionPipeline
  from ..stable_diffusion import StableDiffusionPipelineOutput
label_desc: Use image node_id 2 for calling the ModelWrapper obj's underlying member method code with example usage: obj.apply_model() and returns: self