vllm.transformers_utils.repo_utils ¶
Utilities for model repo interaction.
_get_hf_token ¶
_get_hf_token() -> str | None
Get the HuggingFace token from environment variable.
Returns None if the token is not set, is an empty string, or contains only whitespace. This follows the same pattern as huggingface_hub library which treats empty string tokens as None to avoid authentication errors.
Source code in vllm/transformers_utils/repo_utils.py
file_exists ¶
file_exists(
repo_id: str,
file_name: str,
*,
repo_type: str | None = None,
revision: str | None = None,
token: str | bool | None = None,
) -> bool
Source code in vllm/transformers_utils/repo_utils.py
file_or_path_exists ¶
Source code in vllm/transformers_utils/repo_utils.py
get_hf_file_bytes ¶
get_hf_file_bytes(
file_name: str,
model: str | Path,
revision: str | None = "main",
) -> bytes | None
Get file contents from HuggingFace repository as bytes.
Source code in vllm/transformers_utils/repo_utils.py
get_hf_file_to_dict ¶
Downloads a file from the Hugging Face Hub and returns its contents as a dictionary.
Parameters: - file_name (str): The name of the file to download. - model (str): The name of the model on the Hugging Face Hub. - revision (str): The specific version of the model.
Returns: - config_dict (dict): A dictionary containing the contents of the downloaded file.
Source code in vllm/transformers_utils/repo_utils.py
get_model_path ¶
Source code in vllm/transformers_utils/repo_utils.py
list_filtered_repo_files ¶
list_filtered_repo_files(
model_name_or_path: str,
allow_patterns: list[str],
revision: str | None = None,
repo_type: str | None = None,
token: str | bool | None = None,
) -> list[str]
Source code in vllm/transformers_utils/repo_utils.py
list_repo_files cached ¶
list_repo_files(
repo_id: str,
*,
revision: str | None = None,
repo_type: str | None = None,
token: str | bool | None = None,
) -> list[str]
Source code in vllm/transformers_utils/repo_utils.py
try_get_local_file ¶
try_get_local_file(
model: str | Path,
file_name: str,
revision: str | None = "main",
) -> Path | None
Source code in vllm/transformers_utils/repo_utils.py
with_retry ¶
with_retry(
func: Callable[[], _R],
log_msg: str,
max_retries: int = 2,
retry_delay: int = 2,
) -> _R