class_docstr: Enables Torch ORT: Accelerate PyTorch models with ONNX Runtime.
  
  Wraps a model with the ORT wrapper, lazily converting your module into an ONNX export, to optimize for
  training and inference.
  
  Usage:
  
      # via Transformer Tasks
      model = TextClassifier(backbone="facebook/bart-large", num_classes=datamodule.num_classes, enable_ort=True)
  
      # or via the trainer
      trainer = flash.Trainer(callbacks=ORTCallback())
class_docstr_tok: ["Enables","Torch","ORT",":","Accelerate","PyTorch","models","with","ONNX","Runtime",".","Wraps","a","model","with","the","ORT","wrapper",",","lazily","converting","your","module","into","an","ONNX","export",",","to","optimize","for","training","and","inference",".","Usage",":","#","via","Transformer","Tasks","model","=","TextClassifier","(","backbone=","''","facebook\/bart-large","''",",","num_classes=datamodule.num_classes",",","enable_ort=True",")","#","or","via","the","trainer","trainer","=","flash.Trainer","(","callbacks=ORTCallback","(",")",")"]
code: def on_before_accelerator_backend_setup(
      self, trainer: Trainer, pl_module: LightningModule
  ) -> None:
      if not hasattr(pl_module, "model"):
          raise ValueError(
              "Torch ORT requires to wrap a single model that defines a forward function "
              "assigned as `model` inside the `LightningModule`."
          )
      if not isinstance(pl_module.model, ORTModule):
          pl_module.model = ORTModule(pl_module.model)
  
imports: from pytorch_lightning import Callback, LightningModule, Trainer
  from flash.core.utilities.imports import _TORCH_ORT_AVAILABLE
label_desc: Use image node_id 2 for calling the ORTCallback obj's underlying member method code with example usage: obj.on_before_accelerator_backend_setup(trainer, pl_module) without return types