diff --git a/fastembed/common/model_management.py b/fastembed/common/model_management.py index 5301def80..bfcf27cec 100644 --- a/fastembed/common/model_management.py +++ b/fastembed/common/model_management.py @@ -395,6 +395,10 @@ def download_model(cls, model: T, cache_dir: str, retries: int = 3, **kwargs: An Path: The path to the downloaded model directory. """ local_files_only = kwargs.get("local_files_only", False) + hf_offline = os.environ.get("HF_HUB_OFFLINE", "").strip().upper() + if not local_files_only and hf_offline in {"1", "TRUE", "YES", "ON"}: + local_files_only = True + kwargs["local_files_only"] = True specific_model_path: str | None = kwargs.pop("specific_model_path", None) if specific_model_path: return Path(specific_model_path)