← back to Exo
Remove dead local paths code from download_shard (#1227)
ea9c6d6bdf3c986e8281beeab2999623366083c2 · 2026-01-20 17:07:27 +0000 · Alex Cheema
## Motivation
The `download_progress_for_local_path` function and the "Handle local
paths" code block in `download_shard` are dead code that cannot be
reached in normal usage. The code checks if `model_id` (e.g.,
"mlx-community/Llama-3.2-3B-Instruct-4bit") exists as a filesystem path,
but model IDs are constrained to HuggingFace repo format and there's no
API pathway to pass local paths.
## Changes
- Removed `download_progress_for_local_path()` function (45 lines)
- Removed the "Handle local paths" block in `download_shard()` (7 lines)
## Why It Works
This code was added in PR #669 as part of a "feature-local-models"
branch, but the feature was never fully integrated. The check
`aios.path.exists(str(shard.model_card.model_id))` would only return
true if a directory literally named
"mlx-community/Llama-3.2-3B-Instruct-4bit" existed in the cwd, which
doesn't happen in practice. Offline caching is already handled by
`fetch_file_list_with_cache`.
## Test Plan
### Manual Testing
- Run exo normally and verify downloads still work
### Automated Testing
- Existing tests pass (this code had no test coverage)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Files touched
M src/exo/worker/download/download_utils.py
Diff
commit ea9c6d6bdf3c986e8281beeab2999623366083c2
Author: Alex Cheema <41707476+AlexCheema@users.noreply.github.com>
Date: Tue Jan 20 17:07:27 2026 +0000
Remove dead local paths code from download_shard (#1227)
## Motivation
The `download_progress_for_local_path` function and the "Handle local
paths" code block in `download_shard` are dead code that cannot be
reached in normal usage. The code checks if `model_id` (e.g.,
"mlx-community/Llama-3.2-3B-Instruct-4bit") exists as a filesystem path,
but model IDs are constrained to HuggingFace repo format and there's no
API pathway to pass local paths.
## Changes
- Removed `download_progress_for_local_path()` function (45 lines)
- Removed the "Handle local paths" block in `download_shard()` (7 lines)
## Why It Works
This code was added in PR #669 as part of a "feature-local-models"
branch, but the feature was never fully integrated. The check
`aios.path.exists(str(shard.model_card.model_id))` would only return
true if a directory literally named
"mlx-community/Llama-3.2-3B-Instruct-4bit" existed in the cwd, which
doesn't happen in practice. Offline caching is already handled by
`fetch_file_list_with_cache`.
## Test Plan
### Manual Testing
- Run exo normally and verify downloads still work
### Automated Testing
- Existing tests pass (this code had no test coverage)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
---
src/exo/worker/download/download_utils.py | 55 -------------------------------
1 file changed, 55 deletions(-)
diff --git a/src/exo/worker/download/download_utils.py b/src/exo/worker/download/download_utils.py
index c178f597..441eb4e6 100644
--- a/src/exo/worker/download/download_utils.py
+++ b/src/exo/worker/download/download_utils.py
@@ -477,53 +477,6 @@ async def get_downloaded_size(path: Path) -> int:
return 0
-async def download_progress_for_local_path(
- repo_id: str, shard: ShardMetadata, local_path: Path
-) -> RepoDownloadProgress:
- file_progress: dict[str, RepoFileDownloadProgress] = {}
- total_files = 0
- total_bytes = 0
-
- if await aios.path.isdir(local_path):
- for root, _, files in os.walk(local_path):
- for f in files:
- if f.endswith((".safetensors", ".bin", ".pt", ".gguf", ".json")):
- file_path = Path(root) / f
- size = (await aios.stat(file_path)).st_size
- rel_path = str(file_path.relative_to(local_path))
- file_progress[rel_path] = RepoFileDownloadProgress(
- repo_id=repo_id,
- repo_revision="local",
- file_path=rel_path,
- downloaded=Memory.from_bytes(size),
- downloaded_this_session=Memory.from_bytes(0),
- total=Memory.from_bytes(size),
- speed=0,
- eta=timedelta(0),
- status="complete",
- start_time=time.time(),
- )
- total_files += 1
- total_bytes += size
- else:
- raise ValueError(f"Local path {local_path} is not a directory")
-
- return RepoDownloadProgress(
- repo_id=repo_id,
- repo_revision="local",
- shard=shard,
- completed_files=total_files,
- total_files=total_files,
- downloaded_bytes=Memory.from_bytes(total_bytes),
- downloaded_bytes_this_session=Memory.from_bytes(0),
- total_bytes=Memory.from_bytes(total_bytes),
- overall_speed=0,
- overall_eta=timedelta(0),
- status="complete",
- file_progress=file_progress,
- )
-
-
async def download_shard(
shard: ShardMetadata,
on_progress: Callable[[ShardMetadata, RepoDownloadProgress], Awaitable[None]],
@@ -534,14 +487,6 @@ async def download_shard(
if not skip_download:
logger.info(f"Downloading {shard.model_card.model_id=}")
- # Handle local paths
- if await aios.path.exists(str(shard.model_card.model_id)):
- logger.info(f"Using local model path {shard.model_card.model_id}")
- local_path = Path(str(shard.model_card.model_id))
- return local_path, await download_progress_for_local_path(
- str(shard.model_card.model_id), shard, local_path
- )
-
revision = "main"
target_dir = await ensure_models_dir() / str(shard.model_card.model_id).replace(
"/", "--"
← 4ea66d42 Reduce download log spam (#1225)
·
back to Exo
·
swap all instances of model_id: str for model_id: ModelId (# 22b5d836 →