code: def export_saved_model_to_caffe2(
      saved_model_path: str,
      export_caffe2_path: str,
      output_onnx_path: str = None,
  ) -> None:
      task, train_config, _training_state = load(saved_model_path)
      if hasattr(task, "exporter") and task.exporter is None:
          TaskType = type(train_config.task)
          ExporterConfigType = get_type_hints(TaskType)[
              "exporter"
          ].__args__[0]
          task.exporter = create_exporter(
              ExporterConfigType(),
              train_config.task.features,
              train_config.task.labels,
              task.data_handler.metadata,
          )
      task.export(
          task.model,
          export_caffe2_path,
          export_onnx_path=output_onnx_path,
      )
  
imports: import gzip
  import json
  import os
  import sys
  import traceback
  from typing import Any, Dict, get_type_hints, IO, Iterator, List, Optional, Tuple, Union
  import torch
  from pytext.common.constants import Stage
  from pytext.config import ExportConfig, PyTextConfig, TestConfig
  from pytext.config.component import ComponentType, create_component, create_exporter
  from pytext.data.data import Batcher
  from pytext.data.data_handler import CommonMetadata
  from pytext.metric_reporters.channel import Channel
  from pytext.task import create_task, get_latest_checkpoint_path, load, NewTask, save, Task_Deprecated
  from pytext.task.disjoint_multitask import NewDisjointMultitask
  from pytext.trainers import TrainingState
  from pytext.utils import cuda, distributed, precision, round_seq, set_random_seeds, timing
  from pytext.utils.file_io import PathManager
label_desc: Use image node_id 9 for calling a global function with example usage: export_saved_model_to_caffe2(saved_model_path, export_caffe2_path, output_onnx_path) without return types