[object Object]

← back to Exo

added file exist check

cb53e7175082357384192dd36008d7c2339ec429 · 2024-11-19 02:13:46 -0800 · josh

Files touched

Diff

commit cb53e7175082357384192dd36008d7c2339ec429
Author: josh <eyasufikru567@gmail.com>
Date:   Tue Nov 19 02:13:46 2024 -0800

    added file exist check
---
 exo/download/hf/hf_helpers.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/exo/download/hf/hf_helpers.py b/exo/download/hf/hf_helpers.py
index 6c3347ea..0ec6710b 100644
--- a/exo/download/hf/hf_helpers.py
+++ b/exo/download/hf/hf_helpers.py
@@ -113,7 +113,11 @@ async def move_models_to_hf(seed_dir: Union[str, Path]):
   async for path in source_dir.iterdir():
     if path.is_dir() and path.startswith("models--"):
       dest_path = dest_dir / path.name
-      await aios.rename(str(path), str(dest_path))
+      if dest_path.exists:
+        if DEBUG>=1: print(f"skipping moving {dest_path}. File already exists")
+      else:
+        await aios.rename(str(path), str(dest_path))
+        
 
 async def fetch_file_list(session, repo_id, revision, path=""):
   api_url = f"{get_hf_endpoint()}/api/models/{repo_id}/tree/{revision}"

← 65817ab7 changes to args  ·  back to Exo  ·  typo fix c422cea6 →