Skip to content

cache remote models locally#172

Open
nkundiushuti wants to merge 2 commits intomainfrom
marius/use-hfcache
Open

cache remote models locally#172
nkundiushuti wants to merge 2 commits intomainfrom
marius/use-hfcache

Conversation

@nkundiushuti
Copy link
Copy Markdown
Contributor

This PR makes universal_torch_load() default to cache_mode="use" so Hugging Face (hf://) checkpoints are saved to the local ESP_CACHE_HOME/~/.cache/esp cache and reused across runs.

Impact: second avex.load_model(...) call is much faster (measured ~5× warm-load speedup after a cold download).
Validation: pytest full suite passed (277 passed, 7 skipped) and all examples/*.py using load_model ran successfully on CPU.

fix for #171

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates universal_torch_load() to cache cloud-hosted checkpoints by default, improving repeated model load times (notably for hf:// paths) by persisting downloads under the ESP cache directory.

Changes:

  • Change universal_torch_load() default cache_mode from "none" to "use".
  • Improve cloud-cache keying by hashing the full URI and organizing cached files under a per-bucket subdirectory to reduce filename collisions.
  • Update docstring to reflect the new default caching behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nkundiushuti nkundiushuti changed the title default cache_mode should be "use" cache remote models locally Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants