[object Object]

← back to Exo

add check for path exist

4fdc61729ab777bff141f9c13e3a9410b090ca37 · 2024-11-22 11:44:36 -0800 · josh

Files touched

Diff

commit 4fdc61729ab777bff141f9c13e3a9410b090ca37
Author: josh <eyasufikru567@gmail.com>
Date:   Fri Nov 22 11:44:36 2024 -0800

    add check for path exist
---
 exo/download/hf/hf_helpers.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/exo/download/hf/hf_helpers.py b/exo/download/hf/hf_helpers.py
index 1ac34f31..d551c66d 100644
--- a/exo/download/hf/hf_helpers.py
+++ b/exo/download/hf/hf_helpers.py
@@ -112,10 +112,13 @@ async def move_models_to_hf(seed_dir: Union[str, Path]):
   for path in source_dir.iterdir():
     if path.is_dir() and path.name.startswith("models--"):
       dest_path = dest_dir / path.name
-      try:
-        await aios.rename(str(path), str(dest_path))
-      except Exception as e:
-        print(f'Error moving model to .cache: {e}')
+      if await aios.path.exists(dest_path):
+        if DEBUG>=1: print('Skipping moving model to .cache directory')
+      else:
+        try:
+          await aios.rename(str(path), str(dest_path))
+        except Exception as e:
+          print(f'Error moving model to .cache: {e}')
     
     
     

← 1cb1e9e4 Undo extra line  ·  back to Exo  ·  update tinygrad version 3384fc72 →