code: def export_carton(
      model: LudwigModel,
      carton_path: str,
      carton_model_name="ludwig_model",
  ):
      try:
          import cartonml as carton
      except ImportError:
          raise RuntimeError(
              'The "cartonml-nightly" package is not installed in your environment.'
          )
  
      # Generate a torchscript model
      model_ts = generate_carton_torchscript(model)
  
      with tempfile.TemporaryDirectory() as tmpdir:
          # Save the model to a temp dir
          input_model_path = os.path.join(tmpdir, "model.pt")
          torch.jit.save(model_ts, input_model_path)
  
          # carton.pack is an async function so we run it and wait until it's complete
          # See https://pyo3.rs/v0.20.0/ecosystem/async-await#a-note-about-asynciorun for why we wrap it
          # in another function
          async def pack():
              return await carton.pack(
                  input_model_path,
                  runner_name="torchscript",
                  # Any 2.x.x version is okay
                  # TODO: improve this
                  required_framework_version="=2",
                  model_name=carton_model_name,
                  inputs=_get_input_spec(model),
                  outputs=_get_output_spec(model),
              )
  
          loop = asyncio.get_event_loop()
          tmp_out_path = loop.run_until_complete(pack())
  
          # Move it to the output path
          shutil.move(tmp_out_path, carton_path)
  
file_path: ludwig/ludwig/utils/carton_utils.py
imports: import asyncio
  import importlib.util
  import logging
  import os
  import shutil
  import tempfile
  from typing import Any, Dict, List
  import torch
  from ludwig.api import LudwigModel
  from ludwig.api_annotations import DeveloperAPI
  from ludwig.constants import NAME
  from ludwig.types import ModelConfigDict
  from ludwig.utils.fs_utils import open_file
label_desc: Use image node_id 5 for calling a global function with example usage: export_carton(model, carton_path, carton_model_name) and returns: unknown