class_docstr: Callback that loads the model weights from the state dict.
docstr: Call when inference begins.
  
  Loads the model weights from ``weights_path`` into the PyTorch module.
code: def setup(
      self,
      trainer: Trainer,
      pl_module: AnomalyModule,
      stage: str | None = None,
  ) -> None:
      """Call when inference begins.
  
      Loads the model weights from ``weights_path`` into the PyTorch module.
      """
      del trainer, stage  # These variables are not used.
  
      logger.info("Loading the model from %s", self.weights_path)
      pl_module.load_state_dict(
          torch.load(self.weights_path, map_location=pl_module.device)[
              "state_dict"
          ]
      )
  
file_path: anomalib/src/anomalib/utils/callbacks/model_loader.py
imports: from __future__ import annotations
  import logging
  import torch
  from pytorch_lightning import Callback, Trainer
  from anomalib.models.components import AnomalyModule
label_desc: Use image node_id 2 for calling the LoadModelCallback obj's underlying member method code with example usage: obj.setup(trainer, pl_module, stage) without return types