Skip to content

Commit

Permalink
Added support of gcs offline init
Browse files Browse the repository at this point in the history
  • Loading branch information
I8dNLo committed Sep 26, 2024
1 parent 981f496 commit a8edf2d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fastembed/common/model_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit a8edf2d

Please sign in to comment.