[object Object]

← back to Exo

clean path

ee6f5dade00e87c1c147a6f1f4087d32ef0457da · 2024-11-19 08:44:48 -0800 · josh

Files touched

Diff

commit ee6f5dade00e87c1c147a6f1f4087d32ef0457da
Author: josh <eyasufikru567@gmail.com>
Date:   Tue Nov 19 08:44:48 2024 -0800

    clean path
---
 exo/main.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/exo/main.py b/exo/main.py
index ffd16eda..e9db62bb 100644
--- a/exo/main.py
+++ b/exo/main.py
@@ -193,6 +193,12 @@ async def run_model_cli(node: Node, inference_engine: InferenceEngine, model_nam
   finally:
     node.on_token.deregister(callback_id)
 
+def clean_path(path):
+    """Clean and resolve given path."""
+    """strips swift optional type"""
+    if path.startswith("Optional("):
+        path = path.strip('Optional("').rstrip('")')
+    return os.path.expanduser(path)
 
 async def main():
   loop = asyncio.get_running_loop()
@@ -211,7 +217,8 @@ async def main():
     
   if not args.models_seed_dir is None:
     try:
-      await move_models_to_hf(args.models_seed_dir)
+      models_seed_dir = clean_path(args.models_seed_dir)
+      await move_models_to_hf(models_seed_dir)
     except Exception as e:
       print(f"Error moving models to .cache/huggingface: {e}")
 

← 3a1871c8 typo fix  ·  back to Exo  ·  missing lib 62acc1af →