Skip to content

Commit

Permalink
Check for existing files in cache dir before instantiating a model (#128
Browse files Browse the repository at this point in the history
)

* check for existing files

* (chore: model_management.py):  Add comment

---------

Co-authored-by: Nirant <[email protected]>
  • Loading branch information
nleroy917 and NirantK authored Feb 21, 2024
1 parent 406f432 commit 38c4eb1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fastembed/common/model_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ def retrieve_model_gcs(cls, model_name: str, source_url: str, cache_dir: str) ->
model_tmp_dir = cache_tmp_dir / fast_model_name
model_dir = Path(cache_dir) / fast_model_name

if model_dir.exists():
# check if the model_dir and the model files are both present for macOS
if model_dir.exists() and len(list(model_dir.glob("*"))) > 0:
return model_dir

if model_tmp_dir.exists():
Expand Down

0 comments on commit 38c4eb1

Please sign in to comment.