class_docstr: Task is the central place to define and wire up components for data processing,
  model training, metric reporting, etc. Task class has a Config class containing
  the config of each component in a descriptive way.
class_docstr_tok: ["Task","is","the","central","place","to","define","and","wire","up","components","for","data","processing",",","model","training",",","metric","reporting",",","etc",".","Task","class","has","a","Config","class","containing","the","config","of","each","component","in","a","descriptive","way","."]
docstr: Wrapper method to export PyTorch model to Caffe2 model using :class:`~Exporter`.
  
  Args:
      export_path (str): file path of exported caffe2 model
      metric_channels (List[Channel]): outputs of model's execution graph
      export_onnx_path (str):file path of exported onnx model
docstr_tok: ["Wrapper","method","to","export","PyTorch","model","to","Caffe2","model","using",":","class",":","`","~Exporter","`",".","Args",":","export_path","(","str",")",":","file","path","of","exported","caffe2","model","metric_channels","(","List","[","Channel","]",")",":","outputs","of","model","'s","execution","graph","export_onnx_path","(","str",")",":","file","path","of","exported","onnx","model"]
code: def export(
      self,
      model,
      export_path,
      metric_channels=None,
      export_onnx_path=None,
  ):
      """
      Wrapper method to export PyTorch model to Caffe2 model using :class:`~Exporter`.
  
      Args:
          export_path (str): file path of exported caffe2 model
          metric_channels (List[Channel]): outputs of model's execution graph
          export_onnx_path (str):file path of exported onnx model
      """
      # Make sure to put the model on CPU and disable CUDA before exporting to
      # ONNX to disable any data_parallel pieces
      cuda.CUDA_ENABLED = False
      model = model.cpu()
      optimizer = self.trainer.optimizer
      optimizer.pre_export(model)
  
      if self.exporter:
          if metric_channels:
              print("Exporting metrics")
              self.exporter.export_to_metrics(model, metric_channels)
          print("Saving caffe2 model to: " + export_path)
          self.exporter.export_to_caffe2(
              model, export_path, export_onnx_path
          )
  
imports: from typing import List, Optional
  from pytext.common.constants import BatchContext
  from pytext.config import ConfigBase
  from pytext.config.component import Component, ComponentType, create_component, create_data_handler, create_exporter, create_featurizer, create_metric_reporter, create_model, create_trainer
  from pytext.config.field_config import FeatureConfig
  from pytext.data import DataHandler
  from pytext.data.featurizer import Featurizer, SimpleFeaturizer
  from pytext.exporters import ModelExporter
  from pytext.loss import KLDivergenceBCELoss, KLDivergenceCELoss
  from pytext.metric_reporters import MetricReporter
  from pytext.models import Model
  from pytext.trainers import Trainer
  from pytext.utils import cuda
  from pytext.utils.usage import log_class_usage
label_desc: Use image node_id 5 for calling the TaskBase obj's underlying member method code with example usage: obj.export(model, export_path, metric_channels, export_onnx_path) without return types