class_docstr: Callback that standardizes the image-level and pixel-level anomaly scores.
class_docstr_tok: ["Callback","that","standardizes","the","image-level","and","pixel-level","anomaly","scores","."]
docstr: Create a duplicate of the PL module that can be used to perform inference on the training set.
docstr_tok: ["Create","a","duplicate","of","the","PL","module","that","can","be","used","to","perform","inference","on","the","training","set","."]
code: def _create_inference_model(pl_module):
      """Create a duplicate of the PL module that can be used to perform inference on the training set."""
      new_model = get_model(pl_module.hparams)
      new_model.normalization_metrics = AnomalyScoreDistribution().cpu()
      new_model.load_state_dict(pl_module.state_dict())
      return new_model
  
imports: from __future__ import annotations
  import logging
  from typing import Any
  import pytorch_lightning
  from pytorch_lightning import Callback, Trainer
  from pytorch_lightning.utilities.types import STEP_OUTPUT
  from torch.distributions import LogNormal
  from anomalib.models import get_model
  from anomalib.models.components import AnomalyModule
  from anomalib.post_processing.normalization.cdf import normalize, standardize
  from anomalib.utils.metrics import AnomalyScoreDistribution
label_desc: Use image node_id 9 for calling the CdfNormalizationCallback obj's underlying member method code with example usage: obj._create_inference_model(pl_module) and returns: new_model