code: def get_model_name(model_name_or_path: str) -> str:
      model_name = None
      if os.path.exists(model_name_or_path):
          try:
              model_name = AutoConfig.from_pretrained(
                  model_name_or_path
              )._name_or_path
          except:
              model_name = os.path.basename(model_name_or_path)
              logger.warning(
                  f"Could not deduce model name from {model_name_or_path}. Trying with {model_name=} instead."
              )
      else:
          model_name = model_name_or_path
      return model_name
  
imports: import importlib
  import pickle
  import os
  import time
  import deepspeed
  from dataclasses import dataclass
  from typing import List, TYPE_CHECKING
  from datetime import timedelta
  from huggingface_hub import HfApi
  from transformers import AutoConfig
  import mii
  from mii.constants import MII_CACHE_PATH, MII_CACHE_PATH_DEFAULT, REQUIRED_KEYS_PER_TASK, MII_HF_CACHE_EXPIRATION, MII_HF_CACHE_EXPIRATION_DEFAULT
  from mii.logging import logger
  from mii.score.generate import generated_score_path
label_desc: Use image node_id 3 for calling a global function with example usage: get_model_name(model_name_or_path) and returns: model_name