class_docstr: DSR: A Dual Subspace Re-Projection Network for Surface Anomaly Detection
  
  Args:
      latent_anomaly_strength (float, optional): Strength of the generated anomalies in the latent space.
docstr: Configure the Adam optimizer for training phases 2 and 3. Does not train the discrete
  model (phase 1)
  
  Returns:
      dict[str, torch.optim.Optimizer | torch.optim.LRScheduler]: Dictionary of optimizers
  (the first one having a schedule)
docstr_tok: ["Configure","the","Adam","optimizer","for","training","phases","2","and","3",".","Does","not","train","the","discrete","model","(","phase","1",")","Returns",":","dict","[","str",",","torch.optim.Optimizer","|","torch.optim.LRScheduler","]",":","Dictionary","of","optimizers","(","the","first","one","having","a","schedule",")"]
code: def configure_optimizers(
      self,
  ) -> tuple[
      dict[str, torch.optim.Optimizer | torch.optim.LRScheduler],
      dict[str, torch.optim.Optimizer],
  ]:
      """Configure the Adam optimizer for training phases 2 and 3. Does not train the discrete
      model (phase 1)
  
      Returns:
          dict[str, torch.optim.Optimizer | torch.optim.LRScheduler]: Dictionary of optimizers
      (the first one having a schedule)
      """
      num_steps = max(
          self.trainer.max_steps
          // len(self.trainer.datamodule.train_dataloader()),
          self.trainer.max_epochs,
      )
      self.second_phase = int(
          num_steps * self.hparams.model.upsampling_train_ratio
      )
      anneal = int(0.8 * self.second_phase)
      optimizer_d = torch.optim.Adam(
          params=list(
              self.model.image_reconstruction_network.parameters()
          )
          + list(self.model.subspace_restriction_module_hi.parameters())
          + list(self.model.subspace_restriction_module_lo.parameters())
          + list(self.model.anomaly_detection_module.parameters()),
          lr=self.hparams.model.lr,
      )
      scheduler_d = torch.optim.lr_scheduler.StepLR(
          optimizer_d, anneal, gamma=0.1
      )
  
      optimizer_u = torch.optim.Adam(
          params=self.model.upsampling_module.parameters(),
          lr=self.hparams.model.lr,
      )
  
      return (
          {"optimizer": optimizer_d, "lr_scheduler": scheduler_d},
          {"optimizer": optimizer_u},
      )
  
imports: from __future__ import annotations
  import logging
  from pathlib import Path
  import torch
  from omegaconf import DictConfig, ListConfig
  from pytorch_lightning.utilities.types import STEP_OUTPUT
  from torch import Tensor
  from anomalib.data.utils import DownloadInfo, download_and_extract
  from anomalib.data.utils.augmenter import Augmenter
  from anomalib.models.components import AnomalyModule
  from anomalib.models.dsr.anomaly_generator import DsrAnomalyGenerator
  from anomalib.models.dsr.loss import DsrSecondStageLoss, DsrThirdStageLoss
  from anomalib.models.dsr.torch_model import DsrModel
label_desc: Use image node_id 3 for calling the Dsr obj's underlying member method code with example usage: obj.configure_optimizers() and returns: dict,  dict