docstr: Save model weights and config to local directory.
  Model weights are saved in file `pytorch_model.bin` (timm, hf) or '<ckpt_name>.pth' (mmdet);
  Configs are saved in file `config.json` (timm, hf) or  '<ckpt_name>.py' (mmdet).
  
  Parameters
  ----------
  save_path : str
      Path to directory where models and configs should be saved.
docstr_tok: ["Save","model","weights","and","config","to","local","directory",".","Model","weights","are","saved","in","file","`","pytorch_model.bin","`","(","timm",",","hf",")","or","'","<","ckpt_name",">",".pth","'","(","mmdet",")",";","Configs","are","saved","in","file","`","config.json","`","(","timm",",","hf",")","or","'","<","ckpt_name",">",".py","'","(","mmdet",")",".","Parameters","--","--","--","--","--","save_path",":","str","Path","to","directory","where","models","and","configs","should","be","saved","."]
code: def dump_model(self, save_path: Optional[str] = None):
      """
      Save model weights and config to local directory.
      Model weights are saved in file `pytorch_model.bin` (timm, hf) or '<ckpt_name>.pth' (mmdet);
      Configs are saved in file `config.json` (timm, hf) or  '<ckpt_name>.py' (mmdet).
  
      Parameters
      ----------
      save_path : str
          Path to directory where models and configs should be saved.
      """
  
      if not save_path:
          save_path = self._save_path if self._save_path else "./"
  
      supported_models = {
          TIMM_IMAGE: TimmAutoModelForImagePrediction,
          HF_TEXT: HFAutoModelForTextPrediction,
          MMDET_IMAGE: MMDetAutoModelForObjectDetection,
      }
  
      models = defaultdict(list)
      # TODO: simplify the code
      if isinstance(
          self._model, AbstractMultimodalFusionModel
      ) and isinstance(
          self._model.model, torch.nn.modules.container.ModuleList
      ):
          for per_model in self._model.model:
              for model_key, model_type in supported_models.items():
                  if isinstance(per_model, model_type):
                      models[model_key].append(per_model)
      else:
          for model_key, model_type in supported_models.items():
              if isinstance(self._model, model_type):
                  models[model_key].append(self._model)
  
      if not models:
          raise NotImplementedError(
              f"No models available for dump. Current supported models are: {supported_models.keys()}"
          )
  
      for model_key in models:
          for per_model in models[model_key]:
              subdir = os.path.join(save_path, per_model.prefix)
              os.makedirs(subdir, exist_ok=True)
              per_model.save(save_path=subdir)
  
      return save_path
  
file_path: autogluon/multimodal/src/autogluon/multimodal/utils/export.py
imports: import io
  import logging
  import os
  import warnings
  from collections import defaultdict
  from typing import Dict, List, Optional, Union
  import pandas
  import torch
  from ..constants import CATEGORICAL, HF_TEXT, IMAGE_PATH, MMDET_IMAGE, NULL, NUMERICAL, TEXT, TIMM_IMAGE
  from ..models.fusion import AbstractMultimodalFusionModel
  from ..models.huggingface_text import HFAutoModelForTextPrediction
  from ..models.mmdet_image import MMDetAutoModelForObjectDetection
  from ..models.timm_image import TimmAutoModelForImagePrediction
  from .environment import infer_precision
  from .onnx import OnnxModule, onnx_get_dynamic_axes
label_desc: Use image node_id 1 for calling the ExportMixin obj's underlying member method code with example usage: obj.dump_model(save_path) and returns: save_path