code: def setup_save_path(
      resume: Optional[bool] = None,
      old_save_path: Optional[str] = None,
      proposed_save_path: Optional[str] = None,
      warn_if_exist: Optional[bool] = True,
      raise_if_exist: Optional[bool] = False,
      fit_called: Optional[bool] = None,
  ):
      # TODO: remove redundant folders in DDP mode
      rank = int(os.environ.get("LOCAL_RANK", 0))
      save_path = None
      if resume:
          save_path = process_save_path(path=old_save_path, resume=True)
      elif (
          proposed_save_path is not None
      ):  # TODO: distinguish DDP and existed predictor
          save_path = process_save_path(
              path=proposed_save_path,
              raise_if_exist=(raise_if_exist and rank == 0),
          )
      elif old_save_path is not None:
          if fit_called:
              save_path = process_save_path(
                  path=old_save_path, raise_if_exist=False
              )
          else:
              save_path = process_save_path(
                  path=old_save_path,
                  raise_if_exist=(raise_if_exist and rank == 0),
              )
  
      if not resume:
          save_path = setup_outputdir(
              path=save_path,
              warn_if_exist=warn_if_exist,
          )
          os.makedirs(
              save_path, exist_ok=True
          )  # setup_outputdir doesn't create dir if warn_if_exist==False
  
      save_path = os.path.abspath(os.path.expanduser(save_path))
      logger.debug(f"save path: {save_path}")
  
      return save_path
  
file_path: autogluon/multimodal/src/autogluon/multimodal/utils/save.py
imports: import logging
  import os
  from typing import Dict, List, Optional, Tuple, Union
  from autogluon.common.utils.utils import setup_outputdir
  from ..constants import AUTOMM, HF_MODELS, LAST_CHECKPOINT
  from ..data import TextProcessor
label_desc: Use image node_id 3 for calling a global function with example usage: setup_save_path(resume, old_save_path, proposed_save_path, warn_if_exist, raise_if_exist, fit_called) and returns: save_path