code: def _weight_files_from_dir(d: Path, extension: str) -> List[str]:
      # os.walk: do not iterate, just scan for depth 1, not recursively
      # see _weight_hub_files_from_model_info, that's also what is
      # done there with the len(s.rfilename.split("/")) == 1 condition
      root, _, files = next(os.walk(str(d)))
      filenames = [
          os.path.join(root, f)
          for f in files
          if f.endswith(extension)
          and "arguments" not in f
          and "args" not in f
          and "adapter" not in f
          and "training" not in f
      ]
      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 3 for calling a global function with example usage: _weight_files_from_dir(d, extension) and returns: filenames