From a8edf2d81c86a6fc001d3963747ad9661541991d Mon Sep 17 00:00:00 2001 From: Dmitrii Rudenko Date: Thu, 26 Sep 2024 13:46:08 +0200 Subject: [PATCH] Added support of gcs offline init --- fastembed/common/model_management.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fastembed/common/model_management.py b/fastembed/common/model_management.py index b736a984..177e227e 100644 --- a/fastembed/common/model_management.py +++ b/fastembed/common/model_management.py @@ -164,7 +164,7 @@ def decompress_to_cache(cls, targz_path: str, cache_dir: str): @classmethod def retrieve_model_gcs(cls, model_name: str, source_url: str, cache_dir: str) -> Path: fast_model_name = f"fast-{model_name.split('/')[-1]}" - + print("Model gcs lookup:", fast_model_name) cache_tmp_dir = Path(cache_dir) / "tmp" model_tmp_dir = cache_tmp_dir / fast_model_name model_dir = Path(cache_dir) / fast_model_name @@ -251,7 +251,7 @@ def download_model( f"Could not download model from HuggingFace: {e} " "Falling back to other sources." ) - if url_source: + if url_source or kwargs.get("local_files_only", False): try: return cls.retrieve_model_gcs(model["model"], url_source, str(cache_dir)) except Exception: