class_docstr: Callback for NNCF compression.
  
  Assumes that the pl module contains a 'model' attribute, which is
  the PyTorch module that must be compressed.
  
  Args:
      config (dict): NNCF Configuration
      export_dir (Str): Path where the export `onnx` and the OpenVINO `xml` and `bin` IR are saved.
                        If None model will not be exported.
class_docstr_tok: ["Callback","for","NNCF","compression",".","Assumes","that","the","pl","module","contains","a","'model","'","attribute",",","which","is","the","PyTorch","module","that","must","be","compressed",".","Args",":","config","(","dict",")",":","NNCF","Configuration","export_dir","(","Str",")",":","Path","where","the","export","`","onnx","`","and","the","OpenVINO","`","xml","`","and","`","bin","`","IR","are","saved",".","If","None","model","will","not","be","exported","."]
docstr: Call when the train ends.
  
  Exports onnx model and if compression controller is not None, uses the onnx model to generate the OpenVINO IR.
docstr_tok: ["Call","when","the","train","ends",".","Exports","onnx","model","and","if","compression","controller","is","not","None",",","uses","the","onnx","model","to","generate","the","OpenVINO","IR","."]
code: def on_train_end(
      self, trainer: pl.Trainer, pl_module: pl.LightningModule
  ) -> None:
      """Call when the train ends.
  
      Exports onnx model and if compression controller is not None, uses the onnx model to generate the OpenVINO IR.
      """
      del (
          trainer,
          pl_module,
      )  # `trainer` and `pl_module` variables are not used.
  
      if self.export_dir is None or self.nncf_ctrl is None:
          return
  
      Path(self.export_dir).mkdir(parents=True, exist_ok=True)
      onnx_path = os.path.join(self.export_dir, "model_nncf.onnx")
      self.nncf_ctrl.export_model(onnx_path)
      optimize_command = (
          "mo --input_model "
          + onnx_path
          + " --output_dir "
          + self.export_dir
      )
      os.system(optimize_command)
  
file_path: anomalib/src/anomalib/utils/callbacks/nncf/callback.py
imports: from __future__ import annotations
  import os
  from pathlib import Path
  from typing import Any
  import pytorch_lightning
  from nncf import NNCFConfig
  from nncf.api.compression import CompressionAlgorithmController
  from nncf.torch import register_default_init_args
  from pytorch_lightning import Callback
  from anomalib.utils.callbacks.nncf.utils import InitLoader, wrap_nncf_model
label_desc: Use image node_id 5 for calling the NNCFCallback obj's underlying member method code with example usage: obj.on_train_end(trainer, pl_module) without return types