code: def save_pretrained_model_configs(
      model: nn.Module,
      config: DictConfig,
      path: str,
  ) -> DictConfig:
      """
      Save the pretrained model configs to local to make future loading not dependent on Internet access.
      By initializing models with local configs, Huggingface doesn't need to download pretrained weights from Internet.
  
      Parameters
      ----------
      model
          One model.
      config
          A DictConfig object. The model config should be accessible by "config.model".
      path
          The path to save pretrained model configs.
      """
      # TODO? Fix hardcoded model names.
      requires_saving = any(
          [
              model_name.lower().startswith(HF_MODELS)
              for model_name in config.model.names
          ]
      )
      if not requires_saving:
          return config
  
      if (
          len(config.model.names) == 1
      ):  # TODO: Not sure this is a sufficient check. Hyperparameter "model.names" : ["hf_text", "fusion_mlp"] fails here.
          model = nn.ModuleList([model])
      else:  # assumes the fusion model has a model attribute, a nn.ModuleList
          model = model.model
      for per_model in model:
          if per_model.prefix.lower().startswith(HF_MODELS):
              per_model.config.save_pretrained(
                  os.path.join(path, per_model.prefix)
              )
              model_config = getattr(config.model, per_model.prefix)
              model_config.checkpoint_name = os.path.join(
                  "local://", per_model.prefix
              )
  
      return config
  
imports: import copy
  import logging
  import os
  import re
  import warnings
  from typing import Callable, Dict, List, Optional, Tuple, Union
  from omegaconf import DictConfig, OmegaConf
  from packaging import version
  from torch import nn
  from ..constants import AUTOMM, DATA, FT_TRANSFORMER, FUSION_TRANSFORMER, HF_MODELS, MODEL, REGRESSION, VALID_CONFIG_KEYS
  from ..presets import get_automm_presets, get_basic_automm_config
  from .data import get_detected_data_types
label_desc: Use image node_id 7 for calling a global function with example usage: save_pretrained_model_configs(model, config, path) and returns: config, config