code: def weight_hub_files(
      model_id: str,
      revision: Optional[str] = None,
      extension: str = ".safetensors",
  ) -> List[str]:
      """Get the weights filenames on the hub"""
      api = HfApi()
  
      if HF_HUB_OFFLINE:
          filenames = _cached_weight_files(
              model_id, revision, extension
          )
      else:
          # Online case, fetch model info from the Hub
          info = api.model_info(model_id, revision=revision)
          filenames = _weight_hub_files_from_model_info(info, extension)
  
      if not filenames:
          raise EntryNotFoundError(
              f"No {extension} weights found for model {model_id} and revision {revision}.",
              None,
          )
  
      return filenames
  
file_path: text-generation-inference/server/text_generation_server/utils/hub.py
imports: import time
  import os
  from datetime import timedelta
  from loguru import logger
  from pathlib import Path
  from typing import Optional, List
  from huggingface_hub import file_download, hf_api, HfApi, hf_hub_download
  from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE
  from huggingface_hub.utils import LocalEntryNotFoundError, EntryNotFoundError, RevisionNotFoundError
label_desc: Use image node_id 5 for calling a global function with example usage: weight_hub_files(model_id, revision, extension) and returns: filenames