code: def export_torchscript(
      model_path: str,
      model_only: bool = False,
      output_path: Optional[str] = None,
      device: Optional[str] = None,
      **kwargs,
  ) -> None:
      """Exports a model to torchscript.
  
      # Inputs
  
      :param model_path: (str) filepath to pre-trained model.
      :param model_only: (bool, default: `False`) If true, scripts and exports the model only.
      :param output_path: directory to store torchscript. If `None`, defaults to model_path
  
      # Return
      :returns: (`None`)
      """
      logger.info(f"Model path: {model_path}")
      logger.info(f"Saving model only: {model_only}")
  
      if output_path is None:
          logger.info("output_path is None, defaulting to model_path")
          output_path = model_path
      logger.info(f"Output path: {output_path}")
      logger.info("\n")
  
      model = LudwigModel.load(model_path)
      os.makedirs(output_path, exist_ok=True)
      model.save_torchscript(
          output_path, model_only=model_only, device=device
      )
  
      logger.info(f"Saved to: {output_path}")
  
imports: import argparse
  import logging
  import os
  import sys
  from typing import Optional
  from ludwig.api import LudwigModel
  from ludwig.contrib import add_contrib_callback_args
  from ludwig.globals import LUDWIG_VERSION
  from ludwig.utils.carton_utils import export_carton
  from ludwig.utils.neuropod_utils import export_neuropod
  from ludwig.utils.print_utils import get_logging_level_registry, print_ludwig
  from ludwig.utils.triton_utils import export_triton
label_desc: Use image node_id 1 for calling a global function with example usage: export_torchscript(model_path, model_only, output_path, device) without return types