code: def load_dir_path(
      model_name_or_path: str,
      directory: str,
      token: Optional[Union[bool, str]],
      cache_folder: Optional[str],
  ) -> Optional[str]:
      # If file is local
      dir_path = os.path.join(model_name_or_path, directory)
      if os.path.exists(dir_path):
          return dir_path
  
      download_kwargs = {
          "repo_id": model_name_or_path,
          "allow_patterns": f"{directory}/**",
          "library_name": "sentence-transformers",
          "token": token,
          "cache_dir": cache_folder,
          "tqdm_class": disabled_tqdm,
      }
      # Try to download from the remote
      try:
          repo_path = snapshot_download(**download_kwargs)
      except Exception:
          # Otherwise, try local (i.e. cache) only
          download_kwargs["local_files_only"] = True
          repo_path = snapshot_download(**download_kwargs)
      return os.path.join(repo_path, directory)
  
imports: import functools
  import requests
  from torch import Tensor, device
  from typing import List, Callable
  from tqdm.autonotebook import tqdm
  import sys
  import importlib
  import os
  import torch
  import numpy
  import queue
  import logging
  from typing import Dict, Optional, Union
  from huggingface_hub import snapshot_download, hf_hub_download
  import heapq
label_desc: Use image node_id 18 for calling a global function with example usage: load_dir_path(model_name_or_path, directory, token, cache_folder) and returns: os, dir_path