← back to Exo
changes to args
65817ab7c18209f2ee3595505947b9cab9ded4d0 · 2024-11-19 02:04:48 -0800 · josh
Files touched
M exo/download/hf/hf_helpers.pyM exo/main.py
Diff
commit 65817ab7c18209f2ee3595505947b9cab9ded4d0
Author: josh <eyasufikru567@gmail.com>
Date: Tue Nov 19 02:04:48 2024 -0800
changes to args
---
exo/download/hf/hf_helpers.py | 6 ++++--
exo/main.py | 6 +-----
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/exo/download/hf/hf_helpers.py b/exo/download/hf/hf_helpers.py
index acc2f67d..6c3347ea 100644
--- a/exo/download/hf/hf_helpers.py
+++ b/exo/download/hf/hf_helpers.py
@@ -1,3 +1,5 @@
+import aiofiles.os as aios
+from typing import Union
import asyncio
import aiohttp
import json
@@ -108,10 +110,10 @@ async def move_models_to_hf(seed_dir: Union[str, Path]):
source_dir = Path(seed_dir)
dest_dir = get_hf_home()/"hub"
await aios.makedirs(dest_dir, exist_ok=True)
- for path in source_dir.iterdir():
+ async for path in source_dir.iterdir():
if path.is_dir() and path.startswith("models--"):
dest_path = dest_dir / path.name
- shutil.move(str(path), str(dest_path))
+ 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}"
diff --git a/exo/main.py b/exo/main.py
index ccb016e0..c0a7a6c0 100644
--- a/exo/main.py
+++ b/exo/main.py
@@ -133,11 +133,7 @@ node.on_token.register("update_topology_viz").on_next(
if not args.models_seed_dir is None:
try:
- if is_frozen():
- seed_dir = Path(sys.argv[0]).parent
- await move_models_to_hf(seed_dir)
- else:
- await move_models_to_hf(args.model_seed_dir)
+ await move_models_to_hf(args.models_seed_dir)
except Exception as e:
print(f"Error moving models to .cache/huggingface: {e}")
← 8ad70b20 pr suggestion fixes:
·
back to Exo
·
added file exist check cb53e717 →