code: def cli_collect_activations(sys_argv):
      """Command Line Interface to communicate with the collection of tensors and there are several options that can
      specified when calling this function:
  
      --data_csv: Filepath for the input csv
      --data_hdf5: Filepath for the input hdf5 file, if there is a csv file, this
                   is not read
      --d: Refers to the dataset type of the file being read, by default is
           *generic*
      --s: Refers to the split of the data, can be one of: train, test,
           validation, full
      --m: Input model that is necessary to collect to the tensors, this is a
           required *option*
      --t: Tensors to collect
      --od: Output directory of the model, defaults to results
      --bs: Batch size
      --g: Number of gpus that are to be used
      --gf: Fraction of each GPUs memory to use.
      --v: Verbose: Defines the logging level that the user will be exposed to
      """
      parser = argparse.ArgumentParser(
          description="This script loads a pretrained model and uses it collect "
          "tensors for each datapoint in the dataset.",
          prog="ludwig collect_activations",
          usage="%(prog)s [options]",
      )
  
      # ---------------
      # Data parameters
      # ---------------
      parser.add_argument(
          "--dataset", help="input data file path", required=True
      )
      parser.add_argument(
          "--data_format",
          help="format of the input data",
          default="auto",
          choices=[
              "auto",
              "csv",
              "excel",
              "feather",
              "fwf",
              "hdf5",
              "html" "tables",
              "json",
              "jsonl",
              "parquet",
              "pickle",
              "sas",
              "spss",
              "stata",
              "tsv",
          ],
      )
      parser.add_argument(
          "-s",
          "--split",
          default=FULL,
          choices=[TRAINING, VALIDATION, TEST, FULL],
          help="the split to obtain the model activations from",
      )
  
      # ----------------
      # Model parameters
      # ----------------
      parser.add_argument(
          "-m", "--model_path", help="model to load", required=True
      )
      parser.add_argument(
          "-lyr",
          "--layers",
          help="tensors to collect",
          nargs="+",
          required=True,
      )
  
      # -------------------------
      # Output results parameters
      # -------------------------
      parser.add_argument(
          "-od",
          "--output_directory",
          type=str,
          default="results",
          help="directory that contains the results",
      )
  
      # ------------------
      # Generic parameters
      # ------------------
      parser.add_argument(
          "-bs",
          "--batch_size",
          type=int,
          default=128,
          help="size of batches",
      )
  
      # ------------------
      # Runtime parameters
      # ------------------
      parser.add_argument(
          "-g", "--gpus", type=int, default=0, help="list of gpu to use"
      )
      parser.add_argument(
          "-gml",
          "--gpu_memory_limit",
          type=float,
          default=None,
          help="maximum memory fraction [0, 1] allowed to allocate per GPU device",
      )
      parser.add_argument(
          "-dpt",
          "--disable_parallel_threads",
          action="store_false",
          dest="allow_parallel_threads",
          help="disable PyTorch from using multithreading for reproducibility",
      )
      parser.add_argument(
          "-b",
          "--backend",
          help="specifies backend to use for parallel / distributed execution, "
          "defaults to local execution or Horovod if called using horovodrun",
          choices=ALL_BACKENDS,
      )
      parser.add_argument(
          "-l",
          "--logging_level",
          default="info",
          help="the level of logging to use",
          choices=[
              "critical",
              "error",
              "warning",
              "info",
              "debug",
              "notset",
          ],
      )
  
      add_contrib_callback_args(parser)
      args = parser.parse_args(sys_argv)
  
      args.callbacks = args.callbacks or []
      for callback in args.callbacks:
          callback.on_cmdline("collect_activations", *sys_argv)
  
      args.logging_level = get_logging_level_registry()[
          args.logging_level
      ]
      logging.getLogger("ludwig").setLevel(args.logging_level)
      global logger
      logger = logging.getLogger("ludwig.collect")
  
      print_ludwig("Collect Activations", LUDWIG_VERSION)
  
      collect_activations(**vars(args))
  
imports: import argparse
  import logging
  import os
  import sys
  from typing import List, Optional, Union
  import numpy
  import torch
  import torchinfo
  from ludwig.api import LudwigModel
  from ludwig.backend import ALL_BACKENDS, Backend
  from ludwig.callbacks import Callback
  from ludwig.constants import FULL, TEST, TRAINING, VALIDATION
  from ludwig.contrib import add_contrib_callback_args
  from ludwig.globals import LUDWIG_VERSION
  from ludwig.utils.print_utils import get_logging_level_registry, print_boxed, print_ludwig
  from ludwig.utils.strings_utils import make_safe_filename
label_desc: Use image node_id 5 for calling a global function with example usage: cli_collect_activations(sys_argv) without return types